1 # -*- encoding: utf-8 -*-
4 describe ScrollsController do
6 @admin =FactoryGirl.create :admin
7 @user_yas = FactoryGirl.create :user_yas_with_owner
8 @user_rom = FactoryGirl.create :user_rom
9 @author_yas = @user_yas.author
11 @my_model_class = Scroll #操作モデル
14 if Manifest.manifest.magic_numbers['run_mode'] == 1
15 describe '一覧表示に於いて' do
17 factory_contents :scroll_hello, @author_yas
19 @query_format_json = @query.merge(:format => :json)
30 it 'コントローラのマニフェストから操作モデルを導出している' do
31 set_model? @my_model_class
33 it 'コントローラのマニフェストからリスト操作モデルを導出している' do
34 set_list_model? @my_model_class
36 it 'リストグループのマニフェストからリストgetter(新着リスト)を導出している' do
37 set_list? 'scroll', 'public'
39 it '@itemsにリストを取得している' do
40 expect(assigns(:items).size).to be >= 3
47 it 'ステータス OKを返して、ファイラーを描画している' do
51 it '@filerにファイラーを取得している' do
57 get :index, @query_format_json
59 it 'ステータス OKを返して、jsonデータを返している' do
63 it '@filerにファイラーをセットしていない' do
64 expect(assigns(:filer)).to be nil
73 expect(response.status).to eq(406)
77 it 'ステータス OKを返して、jsonデータを返している' do
79 get :count, @query_format_json
84 context 'ゲスト(サインインしていない)' do
86 get :count, @query_format_json
92 context 'サインインの状態が例外的なとき' do
93 it 'ユーザではなく管理者でも通常通り応答している' do
97 get :index, @query_format_json
100 it '創作活動してないROM専の読者にも通常通り応答している' do
104 get :index, @query_format_json
107 it 'ゲスト(サインインしていない)はサインインページに遷移している' do
109 redirect? sign_in_url
110 get :index, @query_format_json
115 describe '作家フィルタ一覧及びカウント' do
117 factory_contents :scroll_hello, @author_yas
118 @query = {:id => @author_yas.id}
119 @query_format_json = @query.merge(:format => :json)
128 get :by_author, @query
130 it 'コントローラのマニフェストから操作モデルを導出している' do
131 set_model? @my_model_class
133 it 'リストグループのマニフェストから新着リストの取得処理を@listに取得している' do
134 set_list? 'scroll', 'by_author'
136 it '@itemsにリストを取得している' do
137 expect(assigns(:items).size).to be >= 3
142 get :by_author, @query
144 it 'ステータス OKを返して、ファイラーを描画している' do
148 it '@filerにファイラーを取得している' do
154 get :by_author, @query_format_json
156 it 'ステータス OKを返して、jsonデータを返している' do
160 it '@filerにファイラーをセットしていない' do
161 expect(assigns(:filer)).to be nil
167 it '必要ないので実装していない' do
169 get :count_by_author, @query
170 expect(response.status).to eq(406)
176 get :count_by_author, @query_format_json
181 context 'ゲスト(サインインしていない)' do
183 get :count_by_author, @query_format_json
189 context 'サインインの状態が例外的なとき' do
190 it 'ユーザではなく管理者でも通常通り応答している' do
192 get :by_author, @query
194 get :by_author, @query_format_json
197 it '創作活動してないROM専の読者にも通常通り応答している' do
200 get :by_author, @query_format_json
203 it 'ゲスト(サインインしていない)はサインインページに遷移している' do
204 get :by_author, @query
205 redirect? sign_in_url
206 get :by_author, @query_format_json
212 describe 'コマフィルタ一覧及びカウント' do
214 @panel = FactoryGirl.create :panel_hello_with_scroll_panels, author_id: @author_yas.id
215 @query = {:id => @panel.id}
216 @query_format_json = @query.merge(:format => :json)
225 get :by_panel, @query
227 it 'コントローラのマニフェストから操作モデルを導出している' do
228 set_model? @my_model_class
230 it 'リストグループのマニフェストから新着リストの取得処理を@listに取得している' do
231 set_list? 'scroll', 'by_panel'
233 it '@itemsにリストを取得している' do
234 expect(assigns(:items).size).to be >= 3
239 get :by_panel, @query
241 it 'ステータス OKを返して、ファイラーを描画している' do
245 it '@filerにファイラーを取得している' do
251 get :by_panel, @query_format_json
253 it 'ステータス OKを返して、jsonデータを返している' do
257 it '@filerにファイラーをセットしていない' do
258 expect(assigns(:filer)).to be nil
264 it '必要ないので実装していない' do
266 get :count_by_panel, @query
267 expect(response.status).to eq(406)
273 get :count_by_panel, @query_format_json
278 context 'ゲスト(サインインしていない)' do
280 get :count_by_panel, @query_format_json
286 context 'サインインの状態が例外的なとき' do
287 it 'ユーザではなく管理者でも通常通り応答している' do
289 get :by_panel, @query
291 get :by_panel, @query_format_json
294 it '創作活動してないROM専の読者にも通常通り応答している' do
297 get :by_panel, @query_format_json
300 it 'ゲスト(サインインしていない)はサインインページに遷移している' do
301 get :by_panel, @query
302 redirect? sign_in_url
303 get :by_panel, @query_format_json
309 describe '単体表示に於いて' do
311 @item = FactoryGirl.create :scroll_hello, author: @author_yas
313 @query = {:id => @item_id}
314 @query_format_json = @query.merge(:format => :json)
315 @query_format_prof = @query.merge(:format => :prof)
321 context '正常系の共通処理' do
325 it 'コントローラのマニフェストから操作モデルを導出している' do
326 set_model? @my_model_class
328 it '@itemにリクエストしたアイテムを取得している' do
329 expect(assigns(:item)).to eq(@item)
336 it 'showテンプレートを描画している' do
338 expect(response).to render_template("show")
340 it 'プロファイラーは必要ないので@profilerに用意していない' do
341 expect(assigns(:profiler)).to be nil
346 get :show, @query_format_json
352 it 'プロファイラーは必要ないので@profilerに用意していない' do
353 expect(assigns(:profiler)).to be nil
358 get :show, @query_format_prof
360 it 'プロファイラーテンプレートを描画している' do
364 it '@profilerにプロファイラーを取得している' do
369 context 'サインインの状態が例外的なとき' do
370 it 'ユーザではなく管理者でも通常通り応答している' do
374 get :show, @query_format_json
377 it '創作活動してないROM専の読者にも通常通り応答している' do
381 get :show, @query_format_json
384 it 'ゲスト(サインインしていない)はサインインページに遷移している' do
386 redirect? sign_in_url
387 get :show, @query_format_json
393 describe 'プレイリストに於いて' do
395 @item = FactoryGirl.create :scroll_hello_with_scroll_panels, author: @author_yas
397 @query = {:id => @item_id}
398 @query_format_json = @query.merge(:format => :json)
408 it 'コントローラのマニフェストから操作モデルを導出している' do
409 set_model? @my_model_class
411 it '@itemにリクエストしたスクロールを取得している' do
412 expect(assigns(:item)).to eq(@item)
414 it 'コントローラのマニフェストからリスト操作モデルを導出している' do
415 # リクエストの対象はスクロールであるが、返されるのはスクコマのリストである。
417 set_list_model? ScrollPanel
419 it 'リストグループのマニフェストからリストgetter(プレイリスト)を導出している' do
420 set_list? 'scroll_panel', 'play'
422 it '@itemsにプレイリストを取得している' do
423 set_play_list? ScrollPanel
430 it 'playテンプレートを描画している' do
432 expect(response).to render_template("play")
437 get :play, @query_format_json
445 context 'サインインの状態が例外的なとき' do
446 it 'ユーザではなく管理者でも通常通り応答している' do
450 get :play, @query_format_json
453 it '創作活動してないROM専の読者にも通常通り応答している' do
457 get :play, @query_format_json
460 it 'ゲスト(サインインしていない)はサインインページに遷移している' do
462 redirect? sign_in_url
463 get :play, @query_format_json
469 describe '新規作成フォーム表示に於いて' do
472 @query_format_json = @query.merge(:format => :json)
482 it 'コントローラのマニフェストから操作モデルを導出している' do
483 set_model? @my_model_class
485 it '@itemに新規データを用意している' do
486 @item = assigns(:item)
487 expect(@item.is_a?(@my_model_class)).to be true
488 expect(@item.new_record?).to be true
495 it 'スクロールモデルにデフォルト値補充を依頼している' do
496 allow_any_instance_of(@my_model_class).to receive(:supply_default)
497 expect_any_instance_of(@my_model_class).to receive(:supply_default)
505 it 'formテンプレートを描画している' do
509 it '@formに入力フォーム(Bucket)を取得している' do
510 set_bucket? assigns(:item)
515 get :new, @query_format_json
521 it '入力フォームは必要ないので@formに用意していない' do
522 expect(assigns(:form)).to be nil
526 context 'サインインの状態が例外的なとき' do
529 it '創作活動してないROM専の読者は作家登録ページへ遷移している, 例外を発生させている' do
532 redirect? new_author_path
533 announce_regist_author_for_json :get, @query_format_json, :new
535 it 'ゲスト(サインインしていない)はサインインページに遷移している' do
537 redirect? sign_in_url
538 get :new, @query_format_json
541 it 'ユーザではなく管理者でもサインインページに遷移している' do
544 redirect? sign_in_url
545 get :new, @query_format_json
551 describe '新規作成に於いて' do
553 @attributes = FactoryGirl.attributes_for(:scroll_hello, author_id: @author_yas.id)
554 @attr = {:scroll => @attributes}
555 @attr_format_json = @attr.merge(:format => :json)
563 allow_save @my_model_class
566 it 'コントローラのマニフェストから操作モデルを導出している' do
567 set_model? @my_model_class
569 it '@itemに新規アイテムを用意している' do
570 @item = assigns(:item)
571 expect(@item.is_a?(@my_model_class)).to be true
578 it '作成されたアイテムの表示ページへ遷移している' do
579 redirect? @my_model_class.last
584 post :create, @attr_format_json
586 it 'ステータスコード200 OKを返して, 作成されたアイテムをjsonデータで返す' do
595 }.to change {@my_model_class.count}.by(1)
599 context '検証、保存に失敗したとき' do
602 reject_save @my_model_class
608 it 'ステータスコード200 OKを返して, formテンプレートを描画している' do
612 it '@formに入力フォーム(Bucket)を取得している' do
613 set_bucket? assigns(:item)
618 post :create, @attr_format_json
621 render_unprocessable?
625 context 'サインインの状態が例外的なとき' do
627 allow_save @my_model_class
629 it '創作活動してないROM専の読者は作家登録ページへ遷移している, 例外を発生させている' do
632 redirect? new_author_path
633 announce_regist_author_for_json :post, @attr_format_json, :create
635 it 'ゲスト(サインインしていない)はサインインページに遷移している' do
637 redirect? sign_in_url
638 post :create, @attr_format_json
641 it 'ユーザではなく管理者でもサインインページに遷移している' do
644 redirect? sign_in_url
645 post :create, @attr_format_json
651 describe '編集フォーム表示に於いて' do
653 @item = FactoryGirl.create :scroll_hello_with_scroll_panels, author: @author_yas
655 @query = {:id => @item_id}
656 @query_format_json = @query.merge(:format => :json)
666 it 'コントローラのマニフェストから操作モデルを導出している' do
667 set_model? @my_model_class
669 it '@itemにリクエストしたアイテムを取得している' do
670 expect(assigns(:item).is_a?(@my_model_class)).to be true
671 expect(assigns(:item)).to eq(@item)
681 it 'formテンプレートを描画している' do
685 it '@formに入力フォーム(Bucket)を取得している' do
686 set_bucket? assigns(:item)
691 get :edit, @query_format_json
697 it '入力フォームは必要ないので@formに用意していない' do
698 expect(assigns(:form)).to be nil
702 context 'サインインの状態が例外的なとき' do
704 allow_save @my_model_class
706 it '創作活動してないROM専の読者は作家登録ページへ遷移している, 例外を発生させている' do
709 redirect? new_author_path
710 announce_regist_author_for_json :get, @query_format_json, :edit
712 it 'ゲスト(サインインしていない)はサインインページに遷移している' do
714 redirect? sign_in_url
715 post :edit, @query_format_json
718 it 'ユーザではなく管理者でもサインインページに遷移している' do
721 redirect? sign_in_url
722 post :edit, @query_format_json
730 @item = FactoryGirl.create :scroll_hello_with_scroll_panels, author: @author_yas
732 @attributes = FactoryGirl.attributes_for(:scroll_hidden, author_id: @author_yas.id)
733 @attr = {:id => @item_id, :scroll => @attributes}
734 @attr_format_json = @attr.merge(:format => :json)
742 allow_save @my_model_class
745 it 'コントローラのマニフェストから操作モデルを導出している' do
746 set_model? @my_model_class
748 it '@itemにリクエストしたアイテムを取得している' do
749 expect(assigns(:item).is_a?(@my_model_class)).to be true
750 expect(assigns(:item)).to eq(@item)
755 allow_save @my_model_class
758 it 'リクエストしたアイテムの表示ページへ遷移している' do
764 allow_save @my_model_class
765 put :update, @attr_format_json
767 it 'ステータスコード200 OKを返して, ページ本体は特に返さない' do
773 it '@itemの件数に変わりはない' do
776 }.to change {@my_model_class.count}.by(0)
781 updated_item = @my_model_class.find @item_id
782 # 変化を確認できるカラムはモデルごとに違うので注意
783 expect(updated_item.visible).to eq(0)
787 context '検証、保存に失敗したとき' do
790 reject_save @my_model_class
796 it 'ステータスコード200 OKを返して, formテンプレートを描画している' do
800 it '@formに入力フォーム(Bucket)を取得している' do
801 set_bucket? assigns(:item)
806 put :update, @attr_format_json
809 render_unprocessable?
811 it '入力フォームは必要ないので@formに用意していない' do
812 expect(assigns(:form)).to be nil
816 context 'サインインの状態が例外的なとき' do
818 allow_save @my_model_class
820 it '創作活動してないROM専の読者は作家登録ページへ遷移している, 例外を発生させている' do
823 redirect? new_author_path
824 announce_regist_author_for_json :put, @attr_format_json, :update
826 it 'ゲスト(サインインしていない)はサインインページに遷移している' do
828 redirect? sign_in_url
829 put :update, @attr_format_json
832 it 'ユーザではなく管理者でもサインインページに遷移している' do
835 redirect? sign_in_url
836 put :update, @attr_format_json
844 @item = FactoryGirl.create :scroll_hello_with_scroll_panels, author: @author_yas
846 @attr = {:id => @item_id}
847 @attr_format_json = @attr.merge(:format => :json)
855 allow_destroy @my_model_class
856 delete :destroy, @attr
858 it 'コントローラのマニフェストから操作モデルを導出している' do
859 set_model? @my_model_class
861 it '@itemにリクエストしたアイテムを取得している' do
862 expect(assigns(:item).is_a?(@my_model_class)).to be true
863 expect(assigns(:item)).to eq(@item)
868 allow_destroy @my_model_class
869 delete :destroy, @attr
871 it 'マイスクロールの一覧ページへ遷移している' do
872 redirect? '/home/scrolls'
877 allow_destroy @my_model_class
878 delete :destroy, @attr_format_json
880 it 'ステータスコード200 OKを返して, ページ本体は特に返さない' do
881 expect(response).to be_success
888 delete :destroy, @attr
889 }.to change {@my_model_class.count}.by(-1)
891 it 'ぶら下がるリーフも削除されている' do
893 delete :destroy, @attr
894 }.to change {ScrollPanel.count}.from(4).to(0)
898 context '検証、保存に失敗したとき' do
901 reject_destroy @my_model_class
905 delete :destroy, @attr
907 it 'リクエストしたアイテムの詳細ページへ遷移している' do
913 delete :destroy, @attr_format_json
916 render_unprocessable?
920 context 'サインインの状態が例外的なとき' do
922 allow_destroy @my_model_class
924 it '創作活動してないROM専の読者は作家登録ページへ遷移している, 例外を発生させている' do
926 delete :destroy, @attr
927 redirect? new_author_path
928 announce_regist_author_for_json :delete, @attr_format_json, :destroy
930 it 'ゲスト(サインインしていない)はサインインページに遷移している' do
931 delete :destroy, @attr
932 redirect? sign_in_url
933 delete :destroy, @attr_format_json
936 it 'ユーザではなく管理者でもサインインページに遷移している' do
938 delete :destroy, @attr
939 redirect? sign_in_url
940 delete :destroy, @attr_format_json
947 describe '一覧表示に於いて' do
949 @scroll = FactoryGirl.create :scroll, :author_id => @user.author.id
950 Scroll.stub(:list).and_return([@scroll, @scroll, @scroll])
953 context '正常系の共通処理' do
954 it 'ステータスコード200 OKを返す' do
956 response.should be_success
959 it 'indexテンプレートを描画する' do
961 response.should render_template("index")
966 get :index, :format => :json
967 lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
971 context 'ユーザ権限がないとき' do
975 it 'ステータスコード200 OKを返す' do
977 response.should be_success
980 it 'indexテンプレートを描画する' do
982 response.should render_template("index")
987 get :index, :format => :json
988 lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
994 describe '単体表示に於いて' do
996 @scroll = FactoryGirl.create :scroll, :author_id => @user.author.id, :title => 'normal'
997 Scroll.stub(:show).and_return(@scroll)
1000 context '正常系の共通処理' do
1001 it 'ステータスコード200 OKを返す' do
1002 get :show, :id => @scroll.id
1003 response.should be_success
1006 it 'showテンプレートを描画する' do
1007 get :show, :id => @scroll.id
1008 response.should render_template("show")
1013 get :show, :id => @scroll.id, :format => :json
1014 lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
1018 context 'ユーザ権限がないとき' do
1022 it 'ステータスコード200 OKを返す' do
1023 get :show, :id => @scroll.id
1024 response.should be_success
1027 it 'showテンプレートを描画する' do
1028 get :show, :id => @scroll.id
1029 response.should render_template("show")
1034 get :show, :id => @scroll.id, :format => :json
1035 lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
1040 describe 'スクロール数取得に於いて' do
1042 Scroll.should_receive(:visible_count).and_return(3)
1045 context '正常系の共通処理' do
1046 it 'ステータスコード200 OKを返す' do
1047 get :count, :format => :json
1048 response.should be_success
1052 get :count, :format => :json
1053 lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
1059 describe '新規作成フォーム表示に於いて' do
1063 context '正常系の共通処理' do
1064 it 'ステータスコード200 OKを返す' do
1066 response.should be_success
1069 it 'newテンプレートを描画する' do
1071 response.should render_template("new")
1075 it 'new.jsテンプレートを描画する' do
1076 get :new, :format => :js
1077 response.should render_template("new")
1082 get :new, :format => :json
1083 lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
1087 context 'ユーザ権限がないとき' do
1092 it 'ステータスコード302 Foundを返す' do
1094 response.status.should eq 302
1096 it 'サインインページへ遷移する' do
1098 response.body.should redirect_to '/users/sign_in'
1102 it 'ステータスコード401 Unauthorizedを返す' do
1103 get :new, :format => :js
1104 response.status.should eq 401
1106 it '応答メッセージにUnauthorizedを返す' do
1107 get :new, :format => :js
1108 response.message.should match(/Unauthorized/)
1112 it 'ステータスコード401 Unauthorizedを返す' do
1113 get :new, :format => :json
1114 response.status.should eq 401
1116 it '応答メッセージにUnauthorizedを返す' do
1117 get :new, :format => :json
1118 response.message.should match(/Unauthorized/)
1124 describe '新規作成に於いて' do
1127 @attr = FactoryGirl.attributes_for(:scroll, :author_id => @author.id, :title => 'normal')
1129 context '正常系の共通処理' do
1131 it 'ステータスコード302 Foundを返す' do
1132 Scroll.any_instance.stub(:save).and_return(true)
1133 post :create, :scroll => @attr
1134 response.status.should eq 302
1136 it '作成されたスクロールの表示ページへ遷移する' do
1137 # Scroll.any_instance.stub(:save).and_return(true)
1138 post :create, :scroll => @attr
1139 response.should redirect_to(Scroll.last)
1143 it 'ステータスコード200 OKを返す' do
1144 # Scroll.any_instance.stub(:save).and_return(true)
1145 post :create, :scroll => @attr, :format => :json
1146 response.should be_success
1148 it '作成されたスクロールをjsonデータで返す' do
1149 post :create, :scroll => @attr, :format => :json
1150 lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
1154 context 'ユーザ権限がないとき' do
1159 it 'ステータスコード302 Foundを返す' do
1160 post :create, :scroll => @attr
1161 response.status.should eq 302
1163 it 'サインインページへ遷移する' do
1164 post :create, :scroll => @attr
1165 response.body.should redirect_to '/users/sign_in'
1169 it 'ステータスコード401 Unauthorizedを返す' do
1170 post :create, :scroll => @attr, :format => :json
1171 response.status.should eq 401
1173 it '応答メッセージにUnauthorizedを返す' do
1174 post :create, :scroll => @attr, :format => :json
1175 response.message.should match(/Unauthorized/)
1181 describe '編集フォーム表示に於いて' do
1183 @scroll = FactoryGirl.create :scroll, :author_id => @user.author.id
1185 Scroll.stub(:edit).and_return(@scroll)
1187 context '正常系の共通処理' do
1188 it 'ステータスコード200 OKを返す' do
1189 get :edit, :id => @scroll.id
1190 response.should be_success
1193 it 'editテンプレートを描画する' do
1194 get :edit, :id => @scroll.id
1195 response.should render_template("edit")
1199 it 'edit.jsテンプレートを描画する' do
1200 get :edit, :id => @scroll.id, :format => :js
1201 response.should render_template("edit")
1205 context 'ユーザ権限がないとき' do
1210 it 'ステータスコード302 Foundを返す' do
1211 get :edit, :id => @scroll.id
1212 response.status.should eq 302
1214 it 'サインインページへ遷移する' do
1215 get :edit, :id => @scroll.id
1216 response.body.should redirect_to '/users/sign_in'
1220 it 'ステータスコード401 Unauthorizedを返す' do
1221 get :edit, :id => @scroll.id, :format => :js
1222 response.status.should eq 401
1224 it '応答メッセージにUnauthorizedを返す' do
1225 get :edit, :id => @scroll.id, :format => :js
1226 response.message.should match(/Unauthorized/)
1232 describe '更新に於いて' do
1234 @scroll = FactoryGirl.create :scroll, :author => @author
1235 @attr = FactoryGirl.attributes_for(:scroll, :author_id => @author.id, :title => 'updated title', :visible => 0)
1238 context '正常系の共通処理' do
1240 it 'ステータスコード302 Foundを返す' do
1241 Scroll.any_instance.stub(:save).with(any_args()).and_return(true)
1242 put :update, :id => @scroll.id, :scroll => @attr
1243 response.status.should eq 302
1245 it '更新されたスクロールの表示ページへ遷移する' do
1246 put :update, :id => @scroll.id, :scroll => @attr
1247 response.should redirect_to(@scroll)
1251 it 'ステータスコード200 OKを返す' do
1252 Scroll.any_instance.stub(:save).with(any_args()).and_return(true)
1253 put :update, :id => @scroll.id, :scroll => @attr, :format => :json
1254 response.should be_success
1256 it 'ページ本体は特に返さない' do
1257 Scroll.any_instance.stub(:save).with(any_args()).and_return(true)
1258 put :update, :id => @scroll.id, :scroll => @attr, :format => :json
1259 response.body.should match /./
1263 context 'ユーザ権限がないとき' do
1267 it 'ステータスコード302 Foundを返す' do
1268 put :update, :id => @scroll.id, :scroll => @attr
1269 response.status.should eq 302
1272 it 'サインインページへ遷移する' do
1273 put :update, :id => @scroll.id, :scroll => @attr
1274 response.body.should redirect_to '/users/sign_in'
1280 describe '削除に於いて' do
1282 @scroll = FactoryGirl.create :scroll, :author => @author
1285 context '正常系の共通処理' do
1288 Scroll.any_instance.stub(:destroy_with_scroll_panel).with(any_args()).and_return(true)
1290 it 'ステータスコード302 Foundを返す' do
1291 delete :destroy, :id => @scroll.id
1292 response.status.should eq 302
1294 it 'マイスクロールの一覧ページへ遷移する' do
1295 delete :destroy, :id => @scroll.id
1296 response.should redirect_to('/home/scroll')
1301 Scroll.any_instance.stub(:destroy_with_scroll_panel).with(any_args()).and_return(true)
1303 it 'ステータスコード200 OKを返す' do
1304 delete :destroy, :id => @scroll.id, :format => :json
1305 response.should be_success
1307 it 'ページ本体は特に返さない' do
1308 delete :destroy, :id => @scroll.id, :format => :json
1309 response.body.should match /./
1313 context 'ユーザ権限がないとき' do
1317 it 'ステータスコード302 Foundを返す' do
1318 delete :destroy, :id => @scroll.id
1319 response.status.should eq 302
1322 it 'サインインページへ遷移する' do
1323 delete :destroy, :id => @scroll.id
1324 response.body.should redirect_to '/users/sign_in'
1328 it '応答メッセージにUnauthorizedを返す' do
1329 delete :destroy, :id => @scroll.id, :format => :json
1330 response.message.should match(/Unauthorized/)