about summary refs log tree commit diff
path: root/spec/controllers/api_controller_spec.rb
diff options
context:
space:
mode:
authorMatt Jankowski <mjankowski@thoughtbot.com>2017-06-07 11:23:26 -0400
committerEugen Rochko <eugen@zeonfederated.com>2017-06-07 17:23:26 +0200
commitf0634ba876639fcd7e506466683bf71ae81362d4 (patch)
tree8adf600ec5eb00979a72b5f9d545fd6dce58fe4f /spec/controllers/api_controller_spec.rb
parent1d68fe1a60088183e6907a93dc5148b7dd11cdec (diff)
Coverage improvement and concern extraction for rate limit headers in API controller (#3625)
* Coverage for rate limit headers

* Move rate limit headers methods to concern

* Move throttle check to condition on before_action

* Move match_data variable into method

* Move utc timestamp to separate method

* Move header setting into smaller methods

* specs cleanup
Diffstat (limited to 'spec/controllers/api_controller_spec.rb')
-rw-r--r--spec/controllers/api_controller_spec.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/spec/controllers/api_controller_spec.rb b/spec/controllers/api_controller_spec.rb
index 1026afbbc..44be4276a 100644
--- a/spec/controllers/api_controller_spec.rb
+++ b/spec/controllers/api_controller_spec.rb
@@ -9,9 +9,12 @@ describe ApiController, type: :controller do
     end
   end
 
+  before do
+    routes.draw { post 'success' => 'api#success' }
+  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