Sha256: 5cc4de8298bc30ce1b2d035a89f5c9051fff4a03d428a866dd2951237cd5c103

Contents?: true

Size: 1.55 KB

Versions: 5

Compression:

Stored size: 1.55 KB

Contents

require 'spec_helper'

module PaulBunyan
  RSpec.describe Railtie do
    describe 'initializer "initialize_logger.logging"' do
      it 'must extend the logger with ActiveSupport::TaggedLogging' do
        expect(PaulBunyan.logger.primary_logger).to be_kind_of(ActiveSupport::TaggedLogging)
      end
    end

    describe '#unsubscribe_default_log_subscribers' do
      before do
        @action_controller_subscriber = ActiveSupport::LogSubscriber.subscribers.find{|s|
          s.class == ActionController::LogSubscriber
        }

        Railtie.instance.unsubscribe_default_log_subscribers
      end

      after do
        # replace any subscriptions we may have blown away so the next test
        # can be assured of a clean slate
        ActionController::LogSubscriber.attach_to(
          :action_controller,
          @action_controller_subscriber
        )
      end

      it 'must remove the ActionController::LogSubscriber subscription to process_action' do
        expect(subscriber_classes_for('process_action.action_controller')).
          to_not include ActionController::LogSubscriber
      end

      it 'must leave the ActionController::LogSubscriber subscription to deep_munge.action_controller in place' do
        # I don't expect that we'll ever care to unsubcribe the logger
        # non-event so we'll use it as a check to ensure we don't
        # clobber all of the listeners, only the ones we care about
        expect(subscriber_classes_for('logger.action_controller')).
          to include ActionController::LogSubscriber
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
paul_bunyan-1.6.0 spec/lib/paul_bunyan/railtie_spec.rb
paul_bunyan-1.5.3 spec/lib/paul_bunyan/railtie_spec.rb
paul_bunyan-1.5.2 spec/lib/paul_bunyan/railtie_spec.rb
paul_bunyan-1.5.1 spec/lib/paul_bunyan/railtie_spec.rb
paul_bunyan-1.5.0 spec/lib/paul_bunyan/railtie_spec.rb