about summary refs log tree commit diff
path: root/spec/controllers/api_controller_spec.rb
blob: 1026afbbc7d82320d72957ce85a149c6db8379bc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

require 'rails_helper'

describe ApiController, type: :controller do
  controller do
    def success
      head 200
    end
  end

  it 'does not protect from forgery' do
    ActionController::Base.allow_forgery_protection = true
    routes.draw { post 'success' => 'api#success' }
    post 'success'
    expect(response).to have_http_status(:success)
  end
end