aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2009-10-15 18:51:51 -0300
committerJosé Valim <jose.valim@gmail.com>2009-10-15 18:51:51 -0300
commit2d7abe245e7a2b1717e48ef550e4083318fd7ec2 (patch)
tree0de135e1a3c5dadb3f6e1c5457832e6ef81bb834 /activesupport/test
parent5988b87c30eb0ce50c235187f5dfcfcfb98da01b (diff)
downloadrails-2d7abe245e7a2b1717e48ef550e4083318fd7ec2.tar.gz
rails-2d7abe245e7a2b1717e48ef550e4083318fd7ec2.tar.bz2
rails-2d7abe245e7a2b1717e48ef550e4083318fd7ec2.zip
Renamed Orchestra to Notifications once again [#3321 state:resolved]
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/notifications_test.rb (renamed from activesupport/test/orchestra_test.rb)48
1 files changed, 24 insertions, 24 deletions
diff --git a/activesupport/test/orchestra_test.rb b/activesupport/test/notifications_test.rb
index 1b2f98c7dd..561ee2b0ba 100644
--- a/activesupport/test/orchestra_test.rb
+++ b/activesupport/test/notifications_test.rb
@@ -1,13 +1,13 @@
require 'abstract_unit'
# Allow LittleFanout to be cleaned.
-class ActiveSupport::Orchestra::LittleFanout
+class ActiveSupport::Notifications::LittleFanout
def clear
@listeners.clear
end
end
-class OrchestraEventTest < Test::Unit::TestCase
+class NotificationsEventTest < Test::Unit::TestCase
def test_events_are_initialized_with_name_and_payload
event = event(:foo, :payload => :bar)
assert_equal :foo, event.name
@@ -37,24 +37,24 @@ class OrchestraEventTest < Test::Unit::TestCase
protected
def event(*args)
- ActiveSupport::Orchestra::Event.new(*args)
+ ActiveSupport::Notifications::Event.new(*args)
end
end
-class OrchestraMainTest < Test::Unit::TestCase
+class NotificationsMainTest < Test::Unit::TestCase
def setup
@events = []
Thread.abort_on_exception = true
- ActiveSupport::Orchestra.subscribe { |event| @events << event }
+ ActiveSupport::Notifications.subscribe { |event| @events << event }
end
def teardown
Thread.abort_on_exception = false
- ActiveSupport::Orchestra.queue.clear
+ ActiveSupport::Notifications.queue.clear
end
- def test_orchestra_returns_action_result
- result = ActiveSupport::Orchestra.instrument(:awesome, :payload => "orchestra") do
+ def test_notifications_returns_action_result
+ result = ActiveSupport::Notifications.instrument(:awesome, :payload => "notifications") do
1 + 1
end
@@ -62,7 +62,7 @@ class OrchestraMainTest < Test::Unit::TestCase
end
def test_events_are_published_to_a_listener
- ActiveSupport::Orchestra.instrument(:awesome, :payload => "orchestra") do
+ ActiveSupport::Notifications.instrument(:awesome, :payload => "notifications") do
1 + 1
end
@@ -70,12 +70,12 @@ class OrchestraMainTest < Test::Unit::TestCase
assert_equal 1, @events.size
assert_equal :awesome, @events.last.name
- assert_equal Hash[:payload => "orchestra"], @events.last.payload
+ assert_equal Hash[:payload => "notifications"], @events.last.payload
end
def test_nested_events_can_be_instrumented
- ActiveSupport::Orchestra.instrument(:awesome, :payload => "orchestra") do
- ActiveSupport::Orchestra.instrument(:wot, :payload => "child") do
+ ActiveSupport::Notifications.instrument(:awesome, :payload => "notifications") do
+ ActiveSupport::Notifications.instrument(:wot, :payload => "child") do
1 + 1
end
@@ -90,12 +90,12 @@ class OrchestraMainTest < Test::Unit::TestCase
assert_equal 2, @events.size
assert_equal :awesome, @events.last.name
- assert_equal Hash[:payload => "orchestra"], @events.last.payload
+ assert_equal Hash[:payload => "notifications"], @events.last.payload
assert_in_delta 100, @events.last.duration, 70
end
def test_event_is_pushed_even_if_block_fails
- ActiveSupport::Orchestra.instrument(:awesome, :payload => "orchestra") do
+ ActiveSupport::Notifications.instrument(:awesome, :payload => "notifications") do
raise "OMG"
end rescue RuntimeError
@@ -103,22 +103,22 @@ class OrchestraMainTest < Test::Unit::TestCase
assert_equal 1, @events.size
assert_equal :awesome, @events.last.name
- assert_equal Hash[:payload => "orchestra"], @events.last.payload
+ assert_equal Hash[:payload => "notifications"], @events.last.payload
end
def test_event_is_pushed_even_without_block
- ActiveSupport::Orchestra.instrument(:awesome, :payload => "orchestra")
+ ActiveSupport::Notifications.instrument(:awesome, :payload => "notifications")
sleep(0.1)
assert_equal 1, @events.size
assert_equal :awesome, @events.last.name
- assert_equal Hash[:payload => "orchestra"], @events.last.payload
+ assert_equal Hash[:payload => "notifications"], @events.last.payload
end
def test_subscriber_with_pattern
@another = []
- ActiveSupport::Orchestra.subscribe("cache"){ |event| @another << event }
- ActiveSupport::Orchestra.instrument(:cache){ 1 }
+ ActiveSupport::Notifications.subscribe("cache"){ |event| @another << event }
+ ActiveSupport::Notifications.instrument(:cache){ 1 }
sleep(0.1)
@@ -129,10 +129,10 @@ class OrchestraMainTest < Test::Unit::TestCase
def test_subscriber_with_pattern_as_regexp
@another = []
- ActiveSupport::Orchestra.subscribe(/cache/){ |event| @another << event }
+ ActiveSupport::Notifications.subscribe(/cache/){ |event| @another << event }
- ActiveSupport::Orchestra.instrument(:something){ 0 }
- ActiveSupport::Orchestra.instrument(:cache){ 1 }
+ ActiveSupport::Notifications.instrument(:something){ 0 }
+ ActiveSupport::Notifications.instrument(:cache){ 1 }
sleep(0.1)
@@ -143,10 +143,10 @@ class OrchestraMainTest < Test::Unit::TestCase
def test_with_several_consumers_and_several_events
@another = []
- ActiveSupport::Orchestra.subscribe { |event| @another << event }
+ ActiveSupport::Notifications.subscribe { |event| @another << event }
1.upto(100) do |i|
- ActiveSupport::Orchestra.instrument(:value){ i }
+ ActiveSupport::Notifications.instrument(:value){ i }
end
sleep 0.1