about summary refs log tree commit diff
path: root/spec/controllers/api_controller_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/controllers/api_controller_spec.rb')
-rw-r--r--spec/controllers/api_controller_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/controllers/api_controller_spec.rb b/spec/controllers/api_controller_spec.rb
new file mode 100644
index 000000000..1026afbbc
--- /dev/null
+++ b/spec/controllers/api_controller_spec.rb
@@ -0,0 +1,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