Backport with_forgery_protection spec helper

This commit is contained in:
James Edwards-Jones 2018-05-08 22:41:09 +01:00
parent 892b371dad
commit bbc53f2b86

View file

@ -1,11 +1,18 @@
RSpec.configure do |config|
config.around(:each, :allow_forgery_protection) do |example|
begin
module ForgeryProtection
def with_forgery_protection
ActionController::Base.allow_forgery_protection = true
example.call
yield
ensure
ActionController::Base.allow_forgery_protection = false
end
module_function :with_forgery_protection
end
RSpec.configure do |config|
config.around(:each, :allow_forgery_protection) do |example|
ForgeryProtection.with_forgery_protection do
example.call
end
end
end