Welcome to mirror list, hosted at ThFree Co, Russian Federation.

forgery_protection.rb « support « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d12e99b17c48d05427774aaa50c421db91d1cab0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 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

RSpec.configure do |config|
  config.around(:each, :allow_forgery_protection) do |example|
    ForgeryProtection.with_forgery_protection do
      example.call
    end
  end
end