gitlab-org--gitlab-foss/spec/support/forgery_protection.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
508 B
Ruby
Raw Normal View History

# frozen_string_literal: true
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 # rubocop: disable Style/AccessModifierDeclarations
end
2017-07-26 10:34:52 +00:00
RSpec.configure do |config|
config.around(:each, :allow_forgery_protection) do |example|
ForgeryProtection.with_forgery_protection do
2017-07-26 10:34:52 +00:00
example.call
end
end
end