2017-04-12 05:00:43 +09:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
describe Settings::ExportsController do
|
2017-04-13 20:02:02 +09:00
|
|
|
render_views
|
|
|
|
|
2017-04-12 05:00:43 +09:00
|
|
|
describe 'GET #show' do
|
2017-05-30 01:08:26 +09:00
|
|
|
context 'when signed in' do
|
|
|
|
let(:user) { Fabricate(:user) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in user, scope: :user
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'renders export' do
|
|
|
|
get :show
|
|
|
|
|
|
|
|
export = assigns(:export)
|
|
|
|
expect(export).to be_instance_of Export
|
|
|
|
expect(export.account).to eq user.account
|
|
|
|
expect(response).to have_http_status(:success)
|
|
|
|
end
|
|
|
|
end
|
2017-04-13 20:02:02 +09:00
|
|
|
|
2017-05-30 01:08:26 +09:00
|
|
|
context 'when not signed in' do
|
|
|
|
it 'redirects' do
|
|
|
|
get :show
|
|
|
|
expect(response).to redirect_to '/auth/sign_in'
|
|
|
|
end
|
2017-04-12 05:00:43 +09:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|