Sha256: 700d5eef510f35feedc61a9cd88874b61ef6e85951208b28c433a23a9fd2e72f
Contents?: true
Size: 1.3 KB
Versions: 10
Compression:
Stored size: 1.3 KB
Contents
require 'spec_helper' require 'lograge' require 'active_support/notifications' require 'active_support/core_ext/string' require 'active_support/log_subscriber' require 'action_controller/log_subscriber' require 'action_view/log_subscriber' describe Lograge do describe "when removing Rails' log subscribers" do after do ActionController::LogSubscriber.attach_to :action_controller ActionView::LogSubscriber.attach_to :action_view end it "should remove subscribers for controller events" do expect { Lograge.remove_existing_log_subscriptions }.to change { ActiveSupport::Notifications.notifier.listeners_for('process_action.action_controller') } end it "should remove subscribers for all events" do expect { Lograge.remove_existing_log_subscriptions }.to change { ActiveSupport::Notifications.notifier.listeners_for('render_template.action_view') } end it "shouldn't remove subscribers that aren't from Rails" do blk = -> {} ActiveSupport::Notifications.subscribe("process_action.action_controller", &blk) Lograge.remove_existing_log_subscriptions listeners = ActiveSupport::Notifications.notifier.listeners_for('process_action.action_controller') listeners.size.should > 0 end end end
Version data entries
10 entries across 10 versions & 1 rubygems