Sha256: 52a41e3c239f8f9e0de4de148b3942080e9251fae4a7dbc05747592198e73b3b

Contents?: true

Size: 859 Bytes

Versions: 1

Compression:

Stored size: 859 Bytes

Contents

require "spec_helper"

describe Timber::Probes::ActiveSupportLogSubscriber::ActionController do
  before(:each) do
    class PagesController < ActionController::Base
      layout nil

      def index
        response.headers['Content-Length'] = "500"
        render json: {}
      end

      def method_for_action(action_name)
        action_name
      end
    end

    ::RailsApp.routes.draw do
      get 'pages' => 'pages#index'
    end
  end

  after(:each) do
    Object.send(:remove_const, :PagesController)
  end

  let(:response_context_class) { Timber::Contexts::HTTPResponses::ActionController }

  describe "#process_action" do
    it "should set the context" do
      expect_any_instance_of(response_context_class).to receive(:event=).with(kind_of(ActiveSupport::Notifications::Event)).once
      dispatch_rails_request("/pages")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
timberio-1.0.0.beta1 spec/timber/probes/action_controller_log_subscriber/action_controller_spec.rb