Skip to content

Commit

Permalink
Fix ignored block issue in model hooks spec
Browse files Browse the repository at this point in the history
Previously, this wasn't testing what it should, since the block
was ignored.  Caught by the unused block warning in Ruby 3.4.
  • Loading branch information
jeremyevans committed May 20, 2024
1 parent e24a3d6 commit fed7d18
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion spec/model/hooks_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ def after_save

it "#save should have a raised exception reference the model instance" do
@c.send(:define_method, :before_save){cancel_action}
proc{@c.create(:x => 2233)}.must_raise(Sequel::HookFailed){|e| e.model.must_equal @c.load(:x=>2233)}
e = proc{@c.create(:x => 2233)}.must_raise(Sequel::HookFailed)
e.model.must_equal @c.load(:x=>2233)
DB.sqls.must_equal []
end
end
Expand Down

0 comments on commit fed7d18

Please sign in to comment.