SheetPanel.stub(:play_list).with(any_args).and_return([@sheet_panel, @sheet_panel, @sheet_panel])
sign_in @user
end
- context 'パラメータチェックする' do
- it '与えられたoffsetがセットされている' do
- get :play, :id => @sheet.id, :offset => 5
- assigns(:offset).should eq 5
- end
- it '省略されると@offsetに0値が入る' do
- get :play, :id => @sheet.id
- assigns(:offset).should eq 0
- end
- it '与えられたcountがセットされている' do
- get :play, :id => @sheet.id, :count => 4
- assigns(:panel_count).should eq 4
- end
- it '省略されると@panel_countにデフォルト値が入る' do
- get :play, :id => @sheet.id
- assigns(:panel_count).should eq SheetPanel.default_panel_size
- end
- it '最大を超えると@panel_countにデフォルト最大値が入る' do
- get :play, :id => @sheet.id, :count => 1500
- assigns(:panel_count).should eq SheetPanel.max_panel_size
- end
- it '不正な値が入ると@panel_countにデフォルト最大値が入る' do
- get :play, :id => @sheet.id, :count => -1
- assigns(:panel_count).should eq SheetPanel.default_panel_size
- end
- end
context '事前チェックする' do
it '用紙モデルに単体取得を問い合わせている' do
Sheet.should_receive(:show).with(@sheet.id.to_s, [@user, nil]).exactly(1)
get :play, :id => @sheet.id
end
it '紙コマモデルにプレイリスト取得を問い合わせている' do
- SheetPanel.should_receive(:play_list).with(@sheet, @author, 0, 30).exactly(1)
+ SheetPanel.should_receive(:play_list).with(@sheet, @author).exactly(1)
get :play, :id => @sheet.id
end
end