summaryrefslogtreecommitdiff
path: root/spec/support/forgery_protection.rb
blob: fa87d5fa881a62b4c57d88905b1ef8b984054819 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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

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