diff options
Diffstat (limited to 'activemodel/test')
-rw-r--r-- | activemodel/test/cases/observing_test.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/activemodel/test/cases/observing_test.rb b/activemodel/test/cases/observing_test.rb index 9891be8d77..c91938a7ee 100644 --- a/activemodel/test/cases/observing_test.rb +++ b/activemodel/test/cases/observing_test.rb @@ -14,8 +14,8 @@ class FooObserver < ActiveModel::Observer attr_accessor :stub - def on_spec(record) - stub.event_with(record) if stub + def on_spec(record, *args) + stub.event_with(record, *args) if stub end def around_save(record) @@ -141,6 +141,13 @@ class ObserverTest < ActiveModel::TestCase Foo.send(:notify_observers, :on_spec, foo) end + test "passes extra arguments" do + foo = Foo.new + FooObserver.instance.stub = stub + FooObserver.instance.stub.expects(:event_with).with(foo, :bar) + Foo.send(:notify_observers, :on_spec, foo, :bar) + end + test "skips nonexistent observer event" do foo = Foo.new Foo.send(:notify_observers, :whatever, foo) |