| Class | ObjectMonitorTest |
| In: |
lib/object_monitor.rb
|
| Parent: | Test::Unit::TestCase |
# File lib/object_monitor.rb, line 135 def test_accessor assert_respond_to(ObjectMonitor.new(nil), :list_observers) end
# File lib/object_monitor.rb, line 119 def test_exception f = Foo.new obsv = Obsv.new fm = ObjectMonitor.new(f, obsv) assert_equal(0, fm.nb_method) assert_equal([], obsv.last_msg) assert_raises(RuntimeError) { fm.failed } assert_equal(1, fm.nb_method) assert_equal(:start_method, obsv.last_msg[0][0]) assert_equal(2, obsv.last_msg[0].size) assert_equal(:stop_method, obsv.last_msg[1][0]) assert_equal(2, obsv.last_msg[0].size) assert_equal('hello', fm.hello) assert_equal(2, fm.nb_method) end
# File lib/object_monitor.rb, line 105 def test_normal f = Foo.new obsv = Obsv.new fm = ObjectMonitor.new(f, obsv) assert_equal(0, fm.nb_method) assert_equal([], obsv.last_msg) assert_equal('hello', fm.hello) assert_equal(1, fm.nb_method) assert_equal(:start_method, obsv.last_msg[0][0]) assert_equal(2, obsv.last_msg[0].size) assert_equal(:stop_method, obsv.last_msg[1][0]) assert_equal(2, obsv.last_msg[0].size) end