OSDN Git Service

try paging
[pettanr/pettanr.git] / spec / controllers / artists_controller_spec.rb
index f36d754..1409863 100644 (file)
@@ -264,7 +264,8 @@ if MagicNumber['run_mode'] == 1
       @op = FactoryGirl.create :original_picture, :artist_id => @other_artist.id
       @p = FactoryGirl.create :picture, :original_picture_id => @op.id, :license_id => @license.id, :artist_id => @other_artist.id
       @rp = FactoryGirl.create :resource_picture, :artist_id => @other_artist.id, :license_id => @license.id, :original_picture_id => @op.id, :picture_id => @p.id
-      ResourcePicture.stub(:mylist).and_return([@rp, @rp, @rp])
+      Artist.stub(:show).and_return(@artist)
+      ResourcePicture.stub(:himlist).and_return([@rp, @rp, @rp], [nil, nil, nil])
       sign_in @user
     end
     context 'パラメータpageについて' do
@@ -303,7 +304,7 @@ if MagicNumber['run_mode'] == 1
         get :resource_pictures, :id => @other_artist.id
       end
       it '素材モデルに一覧を問い合わせている' do
-        ResourcePicture.should_receive(:mylist).exactly(1)
+        ResourcePicture.should_receive(:himlist).exactly(1)
         get :resource_pictures, :id => @other_artist.id
       end
       it '@resource_picturesにリストを取得している' do
@@ -311,6 +312,10 @@ if MagicNumber['run_mode'] == 1
         assigns(:resource_pictures).should have_at_least(3).items
       end
       context 'html形式' do
+        it '@paginateにページ制御を取得している' do
+          get :resource_pictures, :id => @other_artist.id
+          assigns(:paginate).is_a?(Kaminari::PaginatableArray).should be_true
+        end
         it 'resource_pictureテンプレートを描画する' do
           get :resource_pictures, :id => @other_artist.id
           response.should render_template("resource_pictures")