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

21 lines
508 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
2020-11-24 15:15:51 +05:30
module_function :with_forgery_protection # rubocop: disable Style/AccessModifierDeclarations
2018-11-08 19:23:39 +05:30
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