Backport with_forgery_protection spec helper
This commit is contained in:
parent
892b371dad
commit
bbc53f2b86
1 changed files with 12 additions and 5 deletions
|
@ -1,11 +1,18 @@
|
||||||
RSpec.configure do |config|
|
module ForgeryProtection
|
||||||
config.around(:each, :allow_forgery_protection) do |example|
|
def with_forgery_protection
|
||||||
begin
|
|
||||||
ActionController::Base.allow_forgery_protection = true
|
ActionController::Base.allow_forgery_protection = true
|
||||||
|
yield
|
||||||
example.call
|
|
||||||
ensure
|
ensure
|
||||||
ActionController::Base.allow_forgery_protection = false
|
ActionController::Base.allow_forgery_protection = false
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue