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
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
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