class Notifications::EventTest
Public Instance Methods
test_event_is_parent_based_on_children()
click to toggle source
# File activesupport/test/notifications_test.rb, line 263 def test_event_is_parent_based_on_children time = Time.utc(2009, 01, 01, 0, 0, 1) parent = event(:foo, Time.utc(2009), Time.utc(2009) + 100, random_id, {}) child = event(:foo, time, time + 10, random_id, {}) not_child = event(:foo, time, time + 100, random_id, {}) parent.children << child assert parent.parent_of?(child) assert !child.parent_of?(parent) assert !parent.parent_of?(not_child) assert !not_child.parent_of?(parent) end
test_events_are_initialized_with_details()
click to toggle source
# File activesupport/test/notifications_test.rb, line 249 def test_events_are_initialized_with_details time = Time.now event = event(:foo, time, time + 0.01, random_id, {}) assert_equal :foo, event.name assert_equal time, event.time assert_in_delta 10.0, event.duration, 0.00001 end
test_events_consumes_information_given_as_payload()
click to toggle source
# File activesupport/test/notifications_test.rb, line 258 def test_events_consumes_information_given_as_payload event = event(:foo, Time.now, Time.now + 1, random_id, payload: :bar) assert_equal Hash[payload: :bar], event.payload end
Private Instance Methods
random_id()
click to toggle source
# File activesupport/test/notifications_test.rb, line 279 def random_id @random_id ||= SecureRandom.hex(10) end