Skip to content
This repository has been archived by the owner on Dec 8, 2020. It is now read-only.

Commit

Permalink
Fix specs
Browse files Browse the repository at this point in the history
  • Loading branch information
binarylogic committed Sep 6, 2016
1 parent e97eae1 commit d7f0c77
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions spec/timber/probes/action_controller_base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def method_for_action(action_name)
Object.send(:remove_const, :PagesPlainController)
end

let(:logger_context_class) { Timber::Contexts::Logger }
let(:rack_request_context_class) { Timber::Contexts::HTTPRequests::Rack }
let(:request_context_class) { Timber::Contexts::HTTPRequests::ActionControllerSpecific }
let(:organization_context_class) { Timber::Contexts::Organizations::ActionController }
Expand All @@ -32,6 +33,7 @@ def method_for_action(action_name)

describe "#process" do
it "should set the context" do
allow(Timber::CurrentContext).to receive(:add).with(kind_of(logger_context_class))
expect(Timber::CurrentContext).to receive(:add).with(kind_of(rack_request_context_class)).and_yield.once
expect(Timber::CurrentContext).to receive(:add).with(kind_of(request_context_class), kind_of(organization_context_class), kind_of(user_context_class), kind_of(response_context_class)).and_yield.once
dispatch_rails_request("/pages_plain")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def method_for_action(action_name)
Object.send(:remove_const, :UsersController)
end

let(:logger_context_class) { Timber::Contexts::Logger }
let(:rack_request_context_class) { Timber::Contexts::HTTPRequests::Rack }
let(:request_context_class) { Timber::Contexts::HTTPRequests::ActionControllerSpecific }
let(:organization_context_class) { Timber::Contexts::Organizations::ActionController }
Expand All @@ -33,6 +34,7 @@ def method_for_action(action_name)

describe "#process_action" do
it "should set the context" do
allow(Timber::CurrentContext).to receive(:add).with(kind_of(logger_context_class))
expect(Timber::CurrentContext).to receive(:add).with(kind_of(rack_request_context_class)).and_yield.once
expect(Timber::CurrentContext).to receive(:add).with(kind_of(request_context_class), kind_of(organization_context_class), kind_of(user_context_class), kind_of(response_context_class)).and_yield.once
expect(Timber::CurrentContext).to receive(:add).with(kind_of(action_view_context_class), kind_of(action_view_specific_context_class)).and_yield.once
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def method_for_action(action_name)
let(:exception_context_class) { Timber::Contexts::Exception }

it "should set the context" do
expect(Timber::CurrentContext).to receive(:add).with(kind_of(logger_context_class)).and_yield.once
expect(Timber::CurrentContext).to receive(:add).with(kind_of(logger_context_class)).and_yield.at_least(:once)
expect(Timber::CurrentContext).to receive(:add).with(kind_of(rack_request_context_class)).and_yield.once
expect(Timber::CurrentContext).to receive(:add).with(kind_of(request_context_class), kind_of(organization_context_class), kind_of(user_context_class), kind_of(response_context_class)).and_yield.once
expect(Timber::CurrentContext).to receive(:add).with(kind_of(exception_context_class)).and_yield
Expand Down

0 comments on commit d7f0c77

Please sign in to comment.