Namespace
Methods
S
T
Attributes
[R] instrumenter
[R] notifier
[R] payload
Instance Public methods
setup()
# File activesupport/test/notifications/instrumenter_test.rb, line 21
def setup
  super
  @notifier     = TestNotifier.new
  @instrumenter = Instrumenter.new @notifier
  @payload      =  { :foo => Object.new }
end
test_finish()
# File activesupport/test/notifications/instrumenter_test.rb, line 51
def test_finish
  instrumenter.finish("foo", payload)
  assert_equal [["foo", instrumenter.id, payload]], notifier.finishes
  assert_predicate notifier.starts, :empty?
end
test_instrument()
# File activesupport/test/notifications/instrumenter_test.rb, line 28
def test_instrument
  called  = false
  instrumenter.instrument("foo", payload) {
    called = true
  }

  assert called
end
test_instrument_yields_the_payload_for_further_modification()
# File activesupport/test/notifications/instrumenter_test.rb, line 37
def test_instrument_yields_the_payload_for_further_modification
  assert_equal 2, instrumenter.instrument("awesome") { |p| p[:result] = 1 + 1 }
  assert_equal 1, notifier.finishes.size
  name, _, payload = notifier.finishes.first
  assert_equal "awesome", name
  assert_equal Hash[:result => 2], payload
end
test_start()
# File activesupport/test/notifications/instrumenter_test.rb, line 45
def test_start
  instrumenter.start("foo", payload)
  assert_equal [["foo", instrumenter.id, payload]], notifier.starts
  assert_predicate notifier.finishes, :empty?
end