2018-12-12 17:53:52 -08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-04-11 13:00:43 -07:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
describe Settings::ExportsController do
|
2017-04-13 04:02:02 -07:00
|
|
|
render_views
|
|
|
|
|
2017-04-11 13:00:43 -07:00
|
|
|
describe 'GET #show' do
|
2017-05-29 09:08:26 -07:00
|
|
|
context 'when signed in' do
|
|
|
|
let(:user) { Fabricate(:user) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in user, scope: :user
|
|
|
|
get :show
|
2023-04-19 07:07:29 -07:00
|
|
|
end
|
2017-05-29 09:08:26 -07:00
|
|
|
|
2023-11-10 07:13:42 -08:00
|
|
|
it 'returns http success with private cache control headers', :aggregate_failures do
|
2018-04-21 12:35:07 -07:00
|
|
|
expect(response).to have_http_status(200)
|
2023-04-19 07:07:29 -07:00
|
|
|
expect(response.headers['Cache-Control']).to include('private, no-store')
|
|
|
|
end
|
2017-05-29 09:08:26 -07:00
|
|
|
end
|
2017-04-13 04:02:02 -07:00
|
|
|
|
2017-05-29 09:08:26 -07:00
|
|
|
context 'when not signed in' do
|
|
|
|
it 'redirects' do
|
|
|
|
get :show
|
|
|
|
expect(response).to redirect_to '/auth/sign_in'
|
|
|
|
end
|
2017-04-11 13:00:43 -07:00
|
|
|
end
|
|
|
|
end
|
2018-12-12 17:53:52 -08:00
|
|
|
|
|
|
|
describe 'POST #create' do
|
|
|
|
before do
|
|
|
|
sign_in Fabricate(:user), scope: :user
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'redirects to settings_export_path' do
|
|
|
|
post :create
|
|
|
|
expect(response).to redirect_to(settings_export_path)
|
|
|
|
end
|
|
|
|
|
2024-01-10 03:06:58 -08:00
|
|
|
it 'queues BackupWorker job by 1' do
|
2023-11-23 01:43:43 -08:00
|
|
|
expect do
|
|
|
|
post :create
|
|
|
|
end.to change(BackupWorker.jobs, :size).by(1)
|
2018-12-12 17:53:52 -08:00
|
|
|
end
|
|
|
|
end
|
2017-04-11 13:00:43 -07:00
|
|
|
end
|