In my Grape/Rails app I've implement maintenance mode in ApplicationController
so when this mode is active it will redirect to the maintenance_mode_path
from anywhere in the app. How to force rspec to be in a different endpoint for a while eg. api/v1/new_endpoint
while the whole test takes place in the MaintenanceModeController
?
maintenance_mode_controller_spec
context 'when maintenance mode is active' do
context 'when current page is not maintenance page' do
let(:call_endpoint) { get('/api/v1/new_endpoint') }
it 'redirect to the maintenance page' do
call_endpoint
expect(response).to have_http_status(:redirect)
end
end
end
But with code above I've got an error
Failure/Error: let(:call_endpoint) { get('/api/v1/bank_partners') }
ActionController::UrlGenerationError: No route matches {:action=>"/api/v1/new_endpoint", :controller=>"maintenance_mode"}