diff --git a/shard.yml b/shard.yml index a74e92b..557abd2 100644 --- a/shard.yml +++ b/shard.yml @@ -4,6 +4,6 @@ version: 0.4.4 authors: - Brian J. Cardiff -crystal: 0.22.0 +crystal: 0.24.0 license: MIT diff --git a/spec/database_spec.cr b/spec/database_spec.cr index 51a53a3..e3aeb79 100644 --- a/spec/database_spec.cr +++ b/spec/database_spec.cr @@ -153,7 +153,7 @@ describe DB::Database do connection = uninitialized DB::Connection with_dummy "dummy://localhost:1027?initial_pool_size=1" do |db| connection = DummyDriver::DummyConnection.connections.first - expect_raises do + expect_raises DB::Error do db.prepared.exec("syntax error") end db.pool.is_available?(connection).should be_true @@ -164,7 +164,7 @@ describe DB::Database do connection = uninitialized DB::Connection with_dummy "dummy://localhost:1027?initial_pool_size=1" do |db| connection = DummyDriver::DummyConnection.connections.first - expect_raises do + expect_raises DB::Error do db.unprepared.exec("syntax error") end db.pool.is_available?(connection).should be_true diff --git a/spec/dummy_driver.cr b/spec/dummy_driver.cr index b0dcf42..0ef4b80 100644 --- a/spec/dummy_driver.cr +++ b/spec/dummy_driver.cr @@ -99,7 +99,7 @@ class DummyDriver < DB::Driver def initialize(connection, @query : String, @prepared : Bool) @params = Hash(Int32 | String, DB::Any).new super(connection) - raise query if query == "syntax error" + raise DB::Error.new(query) if query == "syntax error" end protected def perform_query(args : Enumerable) @@ -111,7 +111,7 @@ class DummyDriver < DB::Driver protected def perform_exec(args : Enumerable) @connection.as(DummyConnection).check set_params args - raise "forced exception due to query" if @query == "raise" + raise DB::Error.new("forced exception due to query") if @query == "raise" DB::ExecResult.new 0i64, 0_i64 end diff --git a/spec/dummy_driver_spec.cr b/spec/dummy_driver_spec.cr index a853786..c4da05d 100644 --- a/spec/dummy_driver_spec.cr +++ b/spec/dummy_driver_spec.cr @@ -278,7 +278,7 @@ describe DummyDriver do it "should raise executing raise query" do with_dummy do |db| - expect_raises do + expect_raises DB::Error do db.exec "raise" end end diff --git a/spec/mapping_spec.cr b/spec/mapping_spec.cr index 4cb6225..dc8f7e6 100644 --- a/spec/mapping_spec.cr +++ b/spec/mapping_spec.cr @@ -87,15 +87,21 @@ describe "DB.mapping" do end it "should fail to initialize a simple mapping if types do not match" do - expect_raises { from_dummy("b,a", SimpleMapping) } + expect_raises ArgumentError do + from_dummy("b,a", SimpleMapping) + end end it "should fail to initialize a simple mapping if there is a missing column" do - expect_raises { from_dummy("1", SimpleMapping) } + expect_raises DB::MappingException do + from_dummy("1", SimpleMapping) + end end it "should fail to initialize a simple mapping if there is an unexpected column" do - expect_raises { from_dummy("1,a,b", SimpleMapping) } + expect_raises DB::MappingException do + from_dummy("1,a,b", SimpleMapping) + end end it "should initialize a non-strict mapping if there is an unexpected column" do diff --git a/spec/statement_spec.cr b/spec/statement_spec.cr index 70c3385..fcdd05a 100644 --- a/spec/statement_spec.cr +++ b/spec/statement_spec.cr @@ -147,7 +147,7 @@ describe DB::Statement do it "connection should be released if error occurs during exec" do with_dummy do |db| - expect_raises do + expect_raises DB::Error do db.exec "raise" end DummyDriver::DummyConnection.connections.size.should eq(1)