OSDN Git Service

t#30137:fix authenticate
[pettanr/pettanr.git] / spec / controllers / stories_controller_spec.rb
index b01f7d5..3b8345f 100644 (file)
@@ -129,14 +129,14 @@ if MagicNumber['run_mode'] == 1
     before do
       sign_in @user
       @story = FactoryGirl.create :story, :t => 0, :comic_id => @comic.id, :panel_id => @panel.id, :author_id => @author.id
-      Comic.stub(:show).with(@comic.id.to_s, @author).and_return(@comic)
-      Comic.stub(:show).with(@comic.id.to_s, nil).and_return(@comic)
-      Story.stub(:show).with(@story.id.to_s, @author).and_return(@story)
-      Story.stub(:show).with(@story.id.to_s, nil).and_return(@story)
+      Comic.stub(:show).with(@comic.id.to_s, [@author, nil]).and_return(@comic)
+      Comic.stub(:show).with(@comic.id.to_s, [nil, @admin]).and_return(@comic)
+      Story.stub(:show).with(@story.id.to_s, [@author, nil]).and_return(@story)
+      Story.stub(:show).with(@story.id.to_s, [nil, @admin]).and_return(@story)
     end
     context 'つつがなく終わるとき' do
       it 'ストーリーモデルに単体取得を問い合わせている' do
-        Story.should_receive(:show).with(@story.id.to_s, @author).exactly(1)
+        Story.should_receive(:show).with(@story.id.to_s, [@author, nil]).exactly(1)
         get :show, :id => @story.id
       end
       it '@storyにアレを取得している' do
@@ -215,8 +215,8 @@ if MagicNumber['run_mode'] == 1
   describe '閲覧に於いて' do
     before do
       @story = FactoryGirl.create :story, :t => 0, :comic_id => @comic.id, :panel_id => @panel.id, :author_id => @author.id
-      Comic.stub(:show).with(@comic.id.to_s, @author).and_return(@comic)
-      Comic.stub(:show).with(@comic.id.to_s, nil).and_return(@comic)
+      Comic.stub(:show).with(@comic.id.to_s, [@author, nil]).and_return(@comic)
+      Comic.stub(:show).with(@comic.id.to_s, [nil, @admin]).and_return(@comic)
       Story.stub(:count).and_return(10)
       Story.stub(:play_list).with(any_args).and_return([@story, @story, @story])
       sign_in @user
@@ -249,7 +249,7 @@ if MagicNumber['run_mode'] == 1
     end
     context '事前チェックする' do
       it 'コミックモデルに単体取得を問い合わせている' do
-        Comic.should_receive(:show).with(@comic.id.to_s, @author).exactly(1)
+        Comic.should_receive(:show).with(@comic.id.to_s, [@author, nil]).exactly(1)
         get :comic, :id => @comic.id
       end
       it 'ストーリーモデルにプレイリスト取得を問い合わせている' do