Skip to content

Commit

Permalink
Avoiding global configuration change
Browse files Browse the repository at this point in the history
  • Loading branch information
broisatse committed Apr 20, 2018
1 parent 8884c51 commit 3496b0e
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions lib/rspec/cells/example_group.rb
Expand Up @@ -33,13 +33,24 @@ def route_defined?(method)

before do # called before every it.
@routes = ::Rails.application.routes
ActionController::Base.allow_forgery_protection = false
end

around do |example|
begin
old_value = ActionController::Base.allow_forgery_protection
ActionController::Base.allow_forgery_protection = false

example.run

ensure
ActionController::Base.allow_forgery_protection = old_value
end
end

# add Example::controller and ::controller_class.
extend RSpec::Cells::ExampleGroup::Controller
let (:controller_class) { }
let (:controller) { controller_for(controller_class) }
let(:controller_class) {}
let(:controller) { controller_for(controller_class) }
end


Expand Down

0 comments on commit 3496b0e

Please sign in to comment.