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
This commit is contained in:
Matt Jankowski
2017-06-07 11:23:26 -04:00
committed by Eugen Rochko
parent 1d68fe1a60
commit f0634ba876
4 changed files with 119 additions and 14 deletions

View File

@@ -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