2018-11-08 19:23:39 +05:30
|
|
|
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
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
RSpec.configure do |config|
|
|
|
|
config.around(:each, :allow_forgery_protection) do |example|
|
2018-11-08 19:23:39 +05:30
|
|
|
ForgeryProtection.with_forgery_protection do
|
2017-09-10 17:25:29 +05:30
|
|
|
example.call
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|