From 8b340ab2f62bac2af9d5917e296bb4101530282a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 15 Oct 2009 18:06:15 -0300 Subject: Revert "Rename Orchestra to Notifications [#3321 state:resolved]" This reverts commit 8cbf825425dc8ad3770881ea4e100b9023c69ce2. --- actionmailer/lib/action_mailer/base.rb | 20 +-- actionpack/lib/abstract_controller/logger.rb | 2 +- .../lib/action_controller/caching/fragments.rb | 8 +- actionpack/lib/action_controller/caching/pages.rb | 4 +- actionpack/lib/action_view/template/template.rb | 2 +- actionpack/test/controller/caching_test.rb | 4 +- .../connection_adapters/abstract_adapter.rb | 2 +- activesupport/lib/active_support/autoload.rb | 2 +- activesupport/lib/active_support/cache.rb | 2 +- activesupport/lib/active_support/notifications.rb | 103 ------------- activesupport/lib/active_support/orchestra.rb | 103 +++++++++++++ activesupport/test/notifications_test.rb | 161 --------------------- activesupport/test/orchestra_test.rb | 161 +++++++++++++++++++++ 13 files changed, 287 insertions(+), 287 deletions(-) delete mode 100644 activesupport/lib/active_support/notifications.rb create mode 100644 activesupport/lib/active_support/orchestra.rb delete mode 100644 activesupport/test/notifications_test.rb create mode 100644 activesupport/test/orchestra_test.rb diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 24be66d197..c0c04af51c 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -394,7 +394,7 @@ module ActionMailer #:nodoc: def controller_path self.class.controller_path end - + def formats @template.formats end @@ -481,7 +481,7 @@ module ActionMailer #:nodoc: # Initialize the mailer via the given +method_name+. The body will be # rendered and a new TMail::Mail object created. def create!(method_name, *parameters) #:nodoc: - ActiveSupport::Notifications.instrument(:create_mail, :name => method_name) do + ActiveSupport::Orchestra.instrument(:create_mail, :name => method_name) do initialize_defaults(method_name) __send__(method_name, *parameters) @@ -550,7 +550,7 @@ module ActionMailer #:nodoc: logger.debug "\n#{mail.encoded}" end - ActiveSupport::Notifications.instrument(:deliver_mail, :mail => @mail) do + ActiveSupport::Orchestra.instrument(:deliver_mail, :mail => @mail) do begin __send__("perform_delivery_#{delivery_method}", mail) if perform_deliveries rescue Exception => e # Net::SMTP errors or sendmail pipe errors @@ -583,9 +583,9 @@ module ActionMailer #:nodoc: if template.respond_to?(:mime_type) @current_template_content_type = template.mime_type && template.mime_type.to_sym.to_s end - + @template = initialize_template_class(body) - layout = _pick_layout(layout, true) unless + layout = _pick_layout(layout, true) unless ActionController::Base.exempt_from_layout.include?(template.handler) @template._render_template(template, layout, {}) ensure @@ -601,16 +601,16 @@ module ActionMailer #:nodoc: def render(opts) opts[:locals] ||= {} layout, file = opts.delete(:layout), opts[:file] - + begin @template = initialize_template_class(opts.delete(:body)) - + if file prefix = mailer_name unless file =~ /\// template = view_paths.find(file, {:formats => formats}, prefix) end - layout = _pick_layout(layout, + layout = _pick_layout(layout, !template || ActionController::Base.exempt_from_layout.include?(template.handler)) if template @@ -649,7 +649,7 @@ module ActionMailer #:nodoc: def sort_parts(parts, order = []) order = order.collect { |s| s.downcase } - + parts = parts.sort do |a, b| a_ct = a.content_type.downcase b_ct = b.content_type.downcase @@ -690,7 +690,7 @@ module ActionMailer #:nodoc: headers.each { |k, v| m[k] = v } real_content_type, ctype_attrs = parse_content_type - + if @parts.empty? m.set_content_type(real_content_type, nil, ctype_attrs) m.body = normalize_new_lines(body) diff --git a/actionpack/lib/abstract_controller/logger.rb b/actionpack/lib/abstract_controller/logger.rb index f3130fa5e8..f4d017b8e5 100644 --- a/actionpack/lib/abstract_controller/logger.rb +++ b/actionpack/lib/abstract_controller/logger.rb @@ -47,7 +47,7 @@ module AbstractController # Override process_action in the AbstractController::Base # to log details about the method. def process_action(action) - event = ActiveSupport::Notifications.instrument(:process_action, + event = ActiveSupport::Orchestra.instrument(:process_action, :controller => self, :action => action) do super end diff --git a/actionpack/lib/action_controller/caching/fragments.rb b/actionpack/lib/action_controller/caching/fragments.rb index d30c2625a6..59e24619e3 100644 --- a/actionpack/lib/action_controller/caching/fragments.rb +++ b/actionpack/lib/action_controller/caching/fragments.rb @@ -53,7 +53,7 @@ module ActionController #:nodoc: return content unless cache_configured? key = fragment_cache_key(key) - event = ActiveSupport::Notifications.instrument(:write_fragment, :key => key) do + event = ActiveSupport::Orchestra.instrument(:write_fragment, :key => key) do cache_store.write(key, content, options) end @@ -66,7 +66,7 @@ module ActionController #:nodoc: return unless cache_configured? key = fragment_cache_key(key) - event = ActiveSupport::Notifications.instrument(:read_fragment, :key => key) do + event = ActiveSupport::Orchestra.instrument(:read_fragment, :key => key) do cache_store.read(key, options) end @@ -79,7 +79,7 @@ module ActionController #:nodoc: return unless cache_configured? key = fragment_cache_key(key) - event = ActiveSupport::Notifications.instrument(:fragment_exist?, :key => key) do + event = ActiveSupport::Orchestra.instrument(:fragment_exist?, :key => key) do cache_store.exist?(key, options) end @@ -110,7 +110,7 @@ module ActionController #:nodoc: key = fragment_cache_key(key) unless key.is_a?(Regexp) message = nil - event = ActiveSupport::Notifications.instrument(:expire_fragment, :key => key) do + event = ActiveSupport::Orchestra.instrument(:expire_fragment, :key => key) do if key.is_a?(Regexp) message = "Expired fragments matching: #{key.source}" cache_store.delete_matched(key, options) diff --git a/actionpack/lib/action_controller/caching/pages.rb b/actionpack/lib/action_controller/caching/pages.rb index 0cf245360a..4fb154470f 100644 --- a/actionpack/lib/action_controller/caching/pages.rb +++ b/actionpack/lib/action_controller/caching/pages.rb @@ -64,7 +64,7 @@ module ActionController #:nodoc: return unless perform_caching path = page_cache_path(path) - event = ActiveSupport::Notifications.instrument(:expire_page, :path => path) do + event = ActiveSupport::Orchestra.instrument(:expire_page, :path => path) do File.delete(path) if File.exist?(path) end @@ -78,7 +78,7 @@ module ActionController #:nodoc: return unless perform_caching path = page_cache_path(path) - event = ActiveSupport::Notifications.instrument(:cache_page, :path => path) do + event = ActiveSupport::Orchestra.instrument(:cache_page, :path => path) do FileUtils.makedirs(File.dirname(path)) File.open(path, "wb+") { |f| f.write(content) } end diff --git a/actionpack/lib/action_view/template/template.rb b/actionpack/lib/action_view/template/template.rb index d02feb5e1e..0f64c23649 100644 --- a/actionpack/lib/action_view/template/template.rb +++ b/actionpack/lib/action_view/template/template.rb @@ -27,7 +27,7 @@ module ActionView end def render(view, locals, &block) - ActiveSupport::Notifications.instrument(:render_template, :identifier => identifier) do + ActiveSupport::Orchestra.instrument(:render_template, :identifier => identifier) do method_name = compile(locals, view) view.send(method_name, locals, &block) end.result diff --git a/actionpack/test/controller/caching_test.rb b/actionpack/test/controller/caching_test.rb index 1e13e21419..495b431307 100644 --- a/actionpack/test/controller/caching_test.rb +++ b/actionpack/test/controller/caching_test.rb @@ -630,7 +630,7 @@ class FragmentCachingTest < ActionController::TestCase fragment_computed = false listener = [] - ActiveSupport::Notifications.register listener + ActiveSupport::Orchestra.register listener buffer = 'generated till now -> ' @controller.fragment_for(buffer, 'expensive') { fragment_computed = true } @@ -641,7 +641,7 @@ class FragmentCachingTest < ActionController::TestCase assert fragment_computed assert_equal 'generated till now -> ', buffer ensure - ActiveSupport::Notifications.unregister listener + ActiveSupport::Orchestra.unregister listener end end diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb index 9b65d68fec..694e1e561c 100755 --- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb @@ -201,7 +201,7 @@ module ActiveRecord protected def log(sql, name) - event = ActiveSupport::Notifications.instrument(:sql, :sql => sql, :name => name) do + event = ActiveSupport::Orchestra.instrument(:sql, :sql => sql, :name => name) do yield if block_given? end @runtime += event.duration diff --git a/activesupport/lib/active_support/autoload.rb b/activesupport/lib/active_support/autoload.rb index da12ecceca..a0fc2bb123 100644 --- a/activesupport/lib/active_support/autoload.rb +++ b/activesupport/lib/active_support/autoload.rb @@ -17,7 +17,7 @@ module ActiveSupport autoload :MessageVerifier, 'active_support/message_verifier' autoload :Multibyte, 'active_support/multibyte' autoload :OptionMerger, 'active_support/option_merger' - autoload :Notifications, 'active_support/notifications' + autoload :Orchestra, 'active_support/orchestra' autoload :OrderedHash, 'active_support/ordered_hash' autoload :OrderedOptions, 'active_support/ordered_options' autoload :Rescuable, 'active_support/rescuable' diff --git a/activesupport/lib/active_support/cache.rb b/activesupport/lib/active_support/cache.rb index e0f671f283..a415686020 100644 --- a/activesupport/lib/active_support/cache.rb +++ b/activesupport/lib/active_support/cache.rb @@ -247,7 +247,7 @@ module ActiveSupport payload = { :key => key } payload.merge!(options) if options.is_a?(Hash) - event = ActiveSupport::Notifications.instrument(:"cache_#{operation}", payload, &block) + event = ActiveSupport::Orchestra.instrument(:"cache_#{operation}", payload, &block) log("#{operation} (%.1fms)" % event.duration, key, options) event.result end diff --git a/activesupport/lib/active_support/notifications.rb b/activesupport/lib/active_support/notifications.rb deleted file mode 100644 index 6335686196..0000000000 --- a/activesupport/lib/active_support/notifications.rb +++ /dev/null @@ -1,103 +0,0 @@ -require 'thread' - -module ActiveSupport - # Notifications provides an instrumentation API for Ruby. To instrument an action - # in Ruby you just need to: - # - # ActiveSupport::Notifications.instrument(:render, :extra => :information) do - # render :text => "Foo" - # end - # - # Those actions are consumed by listeners. A listener is anything that responds - # to push. You can even register an array: - # - # @listener = [] - # ActiveSupport::Notifications.register @listener - # - # ActiveSupport::Notifications.instrument(:render, :extra => :information) do - # render :text => "Foo" - # end - # - # event #=> ActiveSupport::Notifications::Event - # event.name #=> :render - # event.duration #=> 10 (in miliseconds) - # event.result #=> "Foo" - # event.payload #=> { :extra => :information } - # - # Notifications ships with a default listener implementation which puts events in - # a stream and consume them in a Thread. This implementation is thread safe - # and is available at ActiveSupport::Notifications::Listener. - # - module Notifications - @stacked_events = Hash.new { |h,k| h[k] = [] } - @listeners = [] - - def self.instrument(name, payload=nil) - stack = @stacked_events[Thread.current.object_id] - event = Event.new(name, stack.last, payload) - stack << event - event.result = yield - event - ensure - event.finish! - stack.delete(event) - @listeners.each { |s| s.push(event) } - end - - def self.register(listener) - @listeners << listener - end - - def self.unregister(listener) - @listeners.delete(listener) - end - - class Event - attr_reader :name, :time, :duration, :parent, :thread_id, :payload - attr_accessor :result - - def initialize(name, parent=nil, payload=nil) - @name = name - @time = Time.now - @thread_id = Thread.current.object_id - @parent = parent - @payload = payload - end - - def finish! - @duration = 1000 * (Time.now.to_f - @time.to_f) - end - end - - class Listener - attr_reader :mutex, :signaler, :thread - - def initialize - @mutex, @signaler = Mutex.new, ConditionVariable.new - @stream = [] - @thread = Thread.new do - loop do - (event = @stream.shift) ? consume(event) : wait - end - end - end - - def wait - @mutex.synchronize do - @signaler.wait(@mutex) - end - end - - def push(event) - @mutex.synchronize do - @stream.push(event) - @signaler.broadcast - end - end - - def consume(event) - raise NotImplementedError - end - end - end -end diff --git a/activesupport/lib/active_support/orchestra.rb b/activesupport/lib/active_support/orchestra.rb new file mode 100644 index 0000000000..efe30669d8 --- /dev/null +++ b/activesupport/lib/active_support/orchestra.rb @@ -0,0 +1,103 @@ +require 'thread' + +module ActiveSupport + # Orchestra provides an instrumentation API for Ruby. To instrument an action + # in Ruby you just need to: + # + # ActiveSupport::Orchestra.instrument(:render, :extra => :information) do + # render :text => "Foo" + # end + # + # Those actions are consumed by listeners. A listener is anything that responds + # to push. You can even register an array: + # + # @listener = [] + # ActiveSupport::Orchestra.register @listener + # + # ActiveSupport::Orchestra.instrument(:render, :extra => :information) do + # render :text => "Foo" + # end + # + # event #=> ActiveSupport::Orchestra::Event + # event.name #=> :render + # event.duration #=> 10 (in miliseconds) + # event.result #=> "Foo" + # event.payload #=> { :extra => :information } + # + # Orchestra ships with a default listener implementation which puts events in + # a stream and consume them in a Thread. This implementation is thread safe + # and is available at ActiveSupport::Orchestra::Listener. + # + module Orchestra + @stacked_events = Hash.new { |h,k| h[k] = [] } + @listeners = [] + + def self.instrument(name, payload=nil) + stack = @stacked_events[Thread.current.object_id] + event = Event.new(name, stack.last, payload) + stack << event + event.result = yield + event + ensure + event.finish! + stack.delete(event) + @listeners.each { |s| s.push(event) } + end + + def self.register(listener) + @listeners << listener + end + + def self.unregister(listener) + @listeners.delete(listener) + end + + class Event + attr_reader :name, :time, :duration, :parent, :thread_id, :payload + attr_accessor :result + + def initialize(name, parent=nil, payload=nil) + @name = name + @time = Time.now + @thread_id = Thread.current.object_id + @parent = parent + @payload = payload + end + + def finish! + @duration = 1000 * (Time.now.to_f - @time.to_f) + end + end + + class Listener + attr_reader :mutex, :signaler, :thread + + def initialize + @mutex, @signaler = Mutex.new, ConditionVariable.new + @stream = [] + @thread = Thread.new do + loop do + (event = @stream.shift) ? consume(event) : wait + end + end + end + + def wait + @mutex.synchronize do + @signaler.wait(@mutex) + end + end + + def push(event) + @mutex.synchronize do + @stream.push(event) + @signaler.broadcast + end + end + + def consume(event) + raise NotImplementedError + end + end + end +end diff --git a/activesupport/test/notifications_test.rb b/activesupport/test/notifications_test.rb deleted file mode 100644 index 8f00eff106..0000000000 --- a/activesupport/test/notifications_test.rb +++ /dev/null @@ -1,161 +0,0 @@ -require 'abstract_unit' - -class NotificationsEventTest < Test::Unit::TestCase - def setup - @parent = ActiveSupport::Notifications::Event.new(:parent) - end - - def test_initialization_with_name_and_parent_and_payload - event = ActiveSupport::Notifications::Event.new(:awesome, @parent, :payload => "notifications") - assert_equal(:awesome, event.name) - assert_equal(@parent, event.parent) - assert_equal({ :payload => "notifications" }, event.payload) - end - - def test_thread_id_is_set_on_initialization - event = ActiveSupport::Notifications::Event.new(:awesome) - assert_equal Thread.current.object_id, event.thread_id - end - - def test_current_time_is_set_on_initialization - previous_time = Time.now.utc - event = ActiveSupport::Notifications::Event.new(:awesome) - assert_kind_of Time, event.time - assert event.time.to_f >= previous_time.to_f - end - - def test_duration_is_set_when_event_finishes - event = ActiveSupport::Notifications::Event.new(:awesome) - sleep(0.1) - event.finish! - assert_in_delta 100, event.duration, 30 - end -end - -class NotificationsMainTest < Test::Unit::TestCase - def setup - @listener = [] - ActiveSupport::Notifications.register @listener - end - - def teardown - ActiveSupport::Notifications.unregister @listener - end - - def test_notifications_allows_any_action_to_be_instrumented - event = ActiveSupport::Notifications.instrument(:awesome, "notifications") do - sleep(0.1) - end - - assert_equal :awesome, event.name - assert_equal "notifications", event.payload - assert_in_delta 100, event.duration, 30 - end - - def test_block_result_is_stored - event = ActiveSupport::Notifications.instrument(:awesome, "notifications") do - 1 + 1 - end - - assert_equal 2, event.result - end - - def test_events_are_published_to_a_listener - event = ActiveSupport::Notifications.instrument(:awesome, "notifications") do - 1 + 1 - end - - assert_equal 1, @listener.size - assert_equal :awesome, @listener.last.name - assert_equal "notifications", @listener.last.payload - end - - def test_nested_events_can_be_instrumented - ActiveSupport::Notifications.instrument(:awesome, "notifications") do - ActiveSupport::Notifications.instrument(:wot, "child") do - sleep(0.1) - end - - assert_equal 1, @listener.size - assert_equal :wot, @listener.first.name - assert_equal "child", @listener.first.payload - - assert_nil @listener.first.parent.duration - assert_in_delta 100, @listener.first.duration, 30 - end - - assert_equal 2, @listener.size - assert_equal :awesome, @listener.last.name - assert_equal "notifications", @listener.last.payload - assert_in_delta 100, @listener.first.parent.duration, 30 - end - - def test_event_is_pushed_even_if_block_fails - ActiveSupport::Notifications.instrument(:awesome, "notifications") do - raise "OMG" - end rescue RuntimeError - - assert_equal 1, @listener.size - assert_equal :awesome, @listener.last.name - assert_equal "notifications", @listener.last.payload - end -end - -class NotificationsListenerTest < Test::Unit::TestCase - class MyListener < ActiveSupport::Notifications::Listener - attr_reader :consumed - - def consume(event) - @consumed ||= [] - @consumed << event - end - end - - def setup - @listener = MyListener.new - ActiveSupport::Notifications.register @listener - end - - def teardown - ActiveSupport::Notifications.unregister @listener - end - - def test_thread_is_exposed_by_listener - assert_kind_of Thread, @listener.thread - end - - def test_event_is_consumed_when_an_action_is_instrumented - ActiveSupport::Notifications.instrument(:sum) do - 1 + 1 - end - sleep 0.1 - assert_equal 1, @listener.consumed.size - assert_equal :sum, @listener.consumed.first.name - assert_equal 2, @listener.consumed.first.result - end - - def test_with_sevaral_consumers_and_several_events - @another = MyListener.new - ActiveSupport::Notifications.register @another - - 1.upto(100) do |i| - ActiveSupport::Notifications.instrument(:value) do - i - end - end - - sleep 0.1 - - assert_equal 100, @listener.consumed.size - assert_equal :value, @listener.consumed.first.name - assert_equal 1, @listener.consumed.first.result - assert_equal 100, @listener.consumed.last.result - - assert_equal 100, @another.consumed.size - assert_equal :value, @another.consumed.first.name - assert_equal 1, @another.consumed.first.result - assert_equal 100, @another.consumed.last.result - ensure - ActiveSupport::Notifications.unregister @another - end -end diff --git a/activesupport/test/orchestra_test.rb b/activesupport/test/orchestra_test.rb new file mode 100644 index 0000000000..683cc36f6a --- /dev/null +++ b/activesupport/test/orchestra_test.rb @@ -0,0 +1,161 @@ +require 'abstract_unit' + +class OrchestraEventTest < Test::Unit::TestCase + def setup + @parent = ActiveSupport::Orchestra::Event.new(:parent) + end + + def test_initialization_with_name_and_parent_and_payload + event = ActiveSupport::Orchestra::Event.new(:awesome, @parent, :payload => "orchestra") + assert_equal(:awesome, event.name) + assert_equal(@parent, event.parent) + assert_equal({ :payload => "orchestra" }, event.payload) + end + + def test_thread_id_is_set_on_initialization + event = ActiveSupport::Orchestra::Event.new(:awesome) + assert_equal Thread.current.object_id, event.thread_id + end + + def test_current_time_is_set_on_initialization + previous_time = Time.now.utc + event = ActiveSupport::Orchestra::Event.new(:awesome) + assert_kind_of Time, event.time + assert event.time.to_f >= previous_time.to_f + end + + def test_duration_is_set_when_event_finishes + event = ActiveSupport::Orchestra::Event.new(:awesome) + sleep(0.1) + event.finish! + assert_in_delta 100, event.duration, 30 + end +end + +class OrchestraMainTest < Test::Unit::TestCase + def setup + @listener = [] + ActiveSupport::Orchestra.register @listener + end + + def teardown + ActiveSupport::Orchestra.unregister @listener + end + + def test_orchestra_allows_any_action_to_be_instrumented + event = ActiveSupport::Orchestra.instrument(:awesome, "orchestra") do + sleep(0.1) + end + + assert_equal :awesome, event.name + assert_equal "orchestra", event.payload + assert_in_delta 100, event.duration, 30 + end + + def test_block_result_is_stored + event = ActiveSupport::Orchestra.instrument(:awesome, "orchestra") do + 1 + 1 + end + + assert_equal 2, event.result + end + + def test_events_are_published_to_a_listener + event = ActiveSupport::Orchestra.instrument(:awesome, "orchestra") do + 1 + 1 + end + + assert_equal 1, @listener.size + assert_equal :awesome, @listener.last.name + assert_equal "orchestra", @listener.last.payload + end + + def test_nested_events_can_be_instrumented + ActiveSupport::Orchestra.instrument(:awesome, "orchestra") do + ActiveSupport::Orchestra.instrument(:wot, "child") do + sleep(0.1) + end + + assert_equal 1, @listener.size + assert_equal :wot, @listener.first.name + assert_equal "child", @listener.first.payload + + assert_nil @listener.first.parent.duration + assert_in_delta 100, @listener.first.duration, 30 + end + + assert_equal 2, @listener.size + assert_equal :awesome, @listener.last.name + assert_equal "orchestra", @listener.last.payload + assert_in_delta 100, @listener.first.parent.duration, 30 + end + + def test_event_is_pushed_even_if_block_fails + ActiveSupport::Orchestra.instrument(:awesome, "orchestra") do + raise "OMG" + end rescue RuntimeError + + assert_equal 1, @listener.size + assert_equal :awesome, @listener.last.name + assert_equal "orchestra", @listener.last.payload + end +end + +class OrchestraListenerTest < Test::Unit::TestCase + class MyListener < ActiveSupport::Orchestra::Listener + attr_reader :consumed + + def consume(event) + @consumed ||= [] + @consumed << event + end + end + + def setup + @listener = MyListener.new + ActiveSupport::Orchestra.register @listener + end + + def teardown + ActiveSupport::Orchestra.unregister @listener + end + + def test_thread_is_exposed_by_listener + assert_kind_of Thread, @listener.thread + end + + def test_event_is_consumed_when_an_action_is_instrumented + ActiveSupport::Orchestra.instrument(:sum) do + 1 + 1 + end + sleep 0.1 + assert_equal 1, @listener.consumed.size + assert_equal :sum, @listener.consumed.first.name + assert_equal 2, @listener.consumed.first.result + end + + def test_with_sevaral_consumers_and_several_events + @another = MyListener.new + ActiveSupport::Orchestra.register @another + + 1.upto(100) do |i| + ActiveSupport::Orchestra.instrument(:value) do + i + end + end + + sleep 0.1 + + assert_equal 100, @listener.consumed.size + assert_equal :value, @listener.consumed.first.name + assert_equal 1, @listener.consumed.first.result + assert_equal 100, @listener.consumed.last.result + + assert_equal 100, @another.consumed.size + assert_equal :value, @another.consumed.first.name + assert_equal 1, @another.consumed.first.result + assert_equal 100, @another.consumed.last.result + ensure + ActiveSupport::Orchestra.unregister @another + end +end -- cgit v1.2.3