Methods
- T
Instance Public methods
test_event_is_pushed_even_without_block()
Link
# File activesupport/test/notifications_test.rb, line 238 def test_event_is_pushed_even_without_block instrument(:awesome, :payload => "notifications") assert_equal 1, @events.size assert_equal :awesome, @events.last.name assert_equal Hash[:payload => "notifications"], @events.last.payload end
test_instrument_publishes_when_exception_is_raised()
Link
# File activesupport/test/notifications_test.rb, line 224 def test_instrument_publishes_when_exception_is_raised begin instrument(:awesome, :payload => "notifications") do raise "FAIL" end rescue RuntimeError => e assert_equal "FAIL", e.message end assert_equal 1, @events.size assert_equal Hash[:payload => "notifications", :exception => ["RuntimeError", "FAIL"], :exception_object => e], @events.last.payload end
test_instrument_returns_block_result()
Link
test_instrument_yields_the_payload_for_further_modification()
Link
# File activesupport/test/notifications_test.rb, line 197 def test_instrument_yields_the_payload_for_further_modification assert_equal 2, instrument(:awesome) { |p| p[:result] = 1 + 1 } assert_equal 1, @events.size assert_equal :awesome, @events.first.name assert_equal Hash[:result => 2], @events.first.payload end
test_instrumenter_exposes_its_id()
Link
test_nested_events_can_be_instrumented()
Link
# File activesupport/test/notifications_test.rb, line 208 def test_nested_events_can_be_instrumented instrument(:awesome, :payload => "notifications") do instrument(:wot, :payload => "child") do 1 + 1 end assert_equal 1, @events.size assert_equal :wot, @events.first.name assert_equal Hash[:payload => "child"], @events.first.payload end assert_equal 2, @events.size assert_equal :awesome, @events.last.name assert_equal Hash[:payload => "notifications"], @events.last.payload end