about summary refs log tree commit diff
path: root/spec
diff options
context:
space:
mode:
authorAkihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp>2017-05-30 01:08:26 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-05-29 18:08:26 +0200
commitbd4dd4c4a0483b36a73c97badec3f7f3e2292c4b (patch)
treec9676d83867920c999ae6bd265d5cbb5d95fdb05 /spec
parent7d33b60f3fd12c20bcc390ae7da9fac5d415ec3c (diff)
Cover Settings::ExportsController more (#3358)
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/settings/exports_controller_spec.rb28
1 files changed, 21 insertions, 7 deletions
diff --git a/spec/controllers/settings/exports_controller_spec.rb b/spec/controllers/settings/exports_controller_spec.rb
index 2be6e4744..19cb0abda 100644
--- a/spec/controllers/settings/exports_controller_spec.rb
+++ b/spec/controllers/settings/exports_controller_spec.rb
@@ -3,15 +3,29 @@ require 'rails_helper'
 describe Settings::ExportsController do
   render_views
 
-  before do
-    sign_in Fabricate(:user), scope: :user
-  end
-
   describe 'GET #show' do
-    it 'returns http success' do
-      get :show
+    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
 
-      expect(response).to have_http_status(:success)
+    context 'when not signed in' do
+      it 'redirects' do
+        get :show
+        expect(response).to redirect_to '/auth/sign_in'
+      end
     end
   end
 end