Commit bbc53f2b authored by James Edwards-Jones's avatar James Edwards-Jones

Backport with_forgery_protection spec helper

parent 892b371d
module ForgeryProtection
def with_forgery_protection
ActionController::Base.allow_forgery_protection = true
yield
ensure
ActionController::Base.allow_forgery_protection = false
end
module_function :with_forgery_protection
end
RSpec.configure do |config| RSpec.configure do |config|
config.around(:each, :allow_forgery_protection) do |example| config.around(:each, :allow_forgery_protection) do |example|
begin ForgeryProtection.with_forgery_protection do
ActionController::Base.allow_forgery_protection = true
example.call example.call
ensure
ActionController::Base.allow_forgery_protection = false
end end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment