Methods
T
Instance Public methods
test_event_is_pushed_even_without_block()
# File activesupport/test/notifications_test.rb, line 223
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()
# File activesupport/test/notifications_test.rb, line 209
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"]], @events.last.payload
end
test_instrument_returns_block_result()
# File activesupport/test/notifications_test.rb, line 178
def test_instrument_returns_block_result
  assert_equal 2, instrument(:awesome) { 1 + 1 }
end
test_instrument_yields_the_payload_for_further_modification()
# File activesupport/test/notifications_test.rb, line 182
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()
# File activesupport/test/notifications_test.rb, line 189
def test_instrumenter_exposes_its_id
  assert_equal 20, ActiveSupport::Notifications.instrumenter.id.size
end
test_nested_events_can_be_instrumented()
# File activesupport/test/notifications_test.rb, line 193
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