debian-mirror-gitlab/spec/support/forgery_protection.rb

21 lines
456 B
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
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