Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
moseshll committed Oct 20, 2023
1 parent 96d75a7 commit b318192
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
22 changes: 22 additions & 0 deletions spec/exceptions_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
require_relative "../lib/hathifiles_database/db/connection"

RSpec.describe HathifilesDatabase::Exception do
describe HathifilesDatabase::Exception::WrongNumberOfColumns do
let(:test_params) { {htid: "test.001", count: 22, expected: 33} }

describe "#initialize" do
it "creates a WrongNumberOfColumns object" do
expect(described_class.new(**test_params)).to be_a HathifilesDatabase::Exception::WrongNumberOfColumns
end
end

describe "#to_s" do
it "includes the htid, expected, and count values" do
@exc = described_class.new(**test_params)
# HathifilesDatabase::Exception::WrongNumberOfColumns htid = test.001 has 22 items (expected 33)
expect(@exc.to_s).to match "test.001"
end
end
end
end

5 changes: 3 additions & 2 deletions spec/hathifiles_database_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
expect(HathifilesDatabase::VERSION).not_to be nil
end



it "can create a connection" do
expect(HathifilesDatabase.new(ENV["HATHIFILES_MYSQL_CONNECTION"])).to be_a HathifilesDatabase::DB::Connection
end
end

0 comments on commit b318192

Please sign in to comment.