2020-02-20 19:13:14 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2021-01-08 20:13:17 +00:00
|
|
|
describe '/app/login', type: :request do
|
|
|
|
context 'without DEFAULT_LOCALE' do
|
2020-02-20 19:13:14 +00:00
|
|
|
it 'renders the dashboard' do
|
2021-01-08 20:13:17 +00:00
|
|
|
get '/app/login'
|
2020-02-20 19:13:14 +00:00
|
|
|
expect(response).to have_http_status(:success)
|
|
|
|
end
|
|
|
|
end
|
2021-01-08 20:13:17 +00:00
|
|
|
|
|
|
|
context 'with DEFAULT_LOCALE' do
|
|
|
|
it 'renders the dashboard' do
|
2021-10-25 07:43:25 +00:00
|
|
|
with_modified_env DEFAULT_LOCALE: 'pt_BR' do
|
|
|
|
get '/app/login'
|
|
|
|
expect(response).to have_http_status(:success)
|
|
|
|
expect(response.body).to include "selectedLocale: 'pt_BR'"
|
|
|
|
end
|
2021-01-08 20:13:17 +00:00
|
|
|
end
|
|
|
|
end
|
2021-05-27 14:37:21 +00:00
|
|
|
|
|
|
|
# Routes are loaded once on app start
|
|
|
|
# hence Rails.application.reload_routes! is used in this spec
|
|
|
|
# ref : https://stackoverflow.com/a/63584877/939299
|
|
|
|
context 'with CW_API_ONLY_SERVER true' do
|
|
|
|
it 'returns 404' do
|
2021-10-25 07:43:25 +00:00
|
|
|
with_modified_env CW_API_ONLY_SERVER: 'true' do
|
|
|
|
Rails.application.reload_routes!
|
|
|
|
get '/app/login'
|
|
|
|
expect(response).to have_http_status(:not_found)
|
|
|
|
end
|
2021-05-27 14:37:21 +00:00
|
|
|
Rails.application.reload_routes!
|
|
|
|
end
|
|
|
|
end
|
2020-02-20 19:13:14 +00:00
|
|
|
end
|