OSDN Git Service

t#31470:create pager
[pettanr/pettanr.git] / spec / controllers / authors_controller_spec.rb
index 0ad1f83..a1dabb8 100644 (file)
@@ -59,6 +59,10 @@ if MagicNumber['run_mode'] == 1
         assigns(:authors).should have_at_least(3).items
       end
       context 'html形式' do
+        it '@paginateにページ制御を取得している' do
+          get :index
+          assigns(:paginate).is_a?(Kaminari::PaginatableArray).should be_true
+        end
         it 'indexテンプレートを描画する' do
           get :index
           response.should render_template("index")
@@ -244,6 +248,7 @@ if MagicNumber['run_mode'] == 1
       @other_author = FactoryGirl.create :author, :user_id => @other_user.id
       @other_artist = FactoryGirl.create :artist_yas, :author_id => @other_author.id
       @comic = FactoryGirl.create :comic, :author_id => @other_user.author.id
+      Author.stub(:show).and_return(@other_author)
       Comic.stub(:himlist).and_return([@comic, @comic, @comic])
       sign_in @user
     end
@@ -291,6 +296,10 @@ if MagicNumber['run_mode'] == 1
         assigns(:comics).should have_at_least(3).items
       end
       context 'html形式' do
+        it '@paginateにページ制御を取得している' do
+          get :comics, :id => @other_author.id
+          assigns(:paginate).is_a?(Kaminari::PaginatableArray).should be_true
+        end
         it 'comicsテンプレートを描画する' do
           get :comics, :id => @other_author.id
           response.should render_template("comics")
@@ -372,6 +381,7 @@ if MagicNumber['run_mode'] == 1
       @comic = FactoryGirl.create :comic, :author_id => @other_user.author.id
       @panel = FactoryGirl.create :panel, :author_id => @other_user.author.id
       @story = FactoryGirl.create :story, :t => 0, :comic_id => @comic.id, :panel_id => @panel.id, :author_id => @other_user.author.id
+      Author.stub(:show).and_return(@other_author)
       Story.stub(:himlist).and_return([@story, @story, @story])
       sign_in @user
     end
@@ -419,6 +429,10 @@ if MagicNumber['run_mode'] == 1
         assigns(:stories).should have_at_least(3).items
       end
       context 'html形式' do
+        it '@paginateにページ制御を取得している' do
+          get :stories, :id => @other_author.id
+          assigns(:paginate).is_a?(Kaminari::PaginatableArray).should be_true
+        end
         it 'storiesテンプレートを描画する' do
           get :stories, :id => @other_author.id
           response.should render_template("stories")
@@ -499,6 +513,7 @@ if MagicNumber['run_mode'] == 1
       @other_author = FactoryGirl.create :author, :user_id => @other_user.id
       @other_artist = FactoryGirl.create :artist_yas, :author_id => @other_author.id
       @panel = FactoryGirl.create :panel, :author_id => @other_author.id
+      Author.stub(:show).and_return(@other_author)
       Panel.stub(:himlist).and_return([@panel, @panel, @panel])
       sign_in @user
     end
@@ -546,6 +561,10 @@ if MagicNumber['run_mode'] == 1
         assigns(:panels).should have_at_least(3).items
       end
       context 'html形式' do
+        it '@paginateにページ制御を取得している' do
+          get :panels, :id => @other_author.id
+          assigns(:paginate).is_a?(Kaminari::PaginatableArray).should be_true
+        end
         it 'panelsテンプレートを描画する' do
           get :panels, :id => @other_author.id
           response.should render_template("panels")
@@ -628,6 +647,7 @@ if MagicNumber['run_mode'] == 1
       @rp = FactoryGirl.create :resource_picture, :artist_id => @artist.id, :license_id => @license.id, :original_picture_id => @op.id, :picture_id => @p.id
       @panel = FactoryGirl.create :panel, :author_id => @author.id
       @panel_picture = FactoryGirl.create :panel_picture, :picture_id => @p.id, :panel_id => @panel.id, :width => @p.width, :height => @p.height
+      Author.stub(:show).and_return(@other_author)
       PanelPicture.stub(:himlist).and_return([@panel_picture, @panel_picture, @panel_picture])
       sign_in @user
     end
@@ -675,6 +695,10 @@ if MagicNumber['run_mode'] == 1
         assigns(:panel_pictures).should have_at_least(3).items
       end
       context 'html形式' do
+        it '@paginateにページ制御を取得している' do
+          get :panel_pictures, :id => @other_author.id
+          assigns(:paginate).is_a?(Kaminari::PaginatableArray).should be_true
+        end
         it 'panel_picturesテンプレートを描画する' do
           get :panel_pictures, :id => @other_author.id
           response.should render_template("panel_pictures")
@@ -759,6 +783,7 @@ if MagicNumber['run_mode'] == 1
       @rp = FactoryGirl.create :resource_picture, :artist_id => @artist.id, :license_id => @license.id, :original_picture_id => @op.id, :picture_id => @p.id
       @panel = FactoryGirl.create :panel, :author_id => @author.id
       @ground_picture = FactoryGirl.create :ground_picture, :panel_id => @panel.id, :picture_id => @p.id
+      Author.stub(:show).and_return(@other_author)
       GroundPicture.stub(:himlist).and_return([@ground_picture, @ground_picture, @ground_picture])
       sign_in @user
     end
@@ -806,6 +831,10 @@ if MagicNumber['run_mode'] == 1
         assigns(:ground_pictures).should have_at_least(3).items
       end
       context 'html形式' do
+        it '@paginateにページ制御を取得している' do
+          get :ground_pictures, :id => @other_author.id
+          assigns(:paginate).is_a?(Kaminari::PaginatableArray).should be_true
+        end
         it 'ground_picturesテンプレートを描画する' do
           get :ground_pictures, :id => @other_author.id
           response.should render_template("ground_pictures")
@@ -887,6 +916,7 @@ if MagicNumber['run_mode'] == 1
       @other_artist = FactoryGirl.create :artist_yas, :author_id => @other_author.id
       @gc = FactoryGirl.create :ground_color
       @panel = FactoryGirl.create :panel, :author_id => @author.id
+      Author.stub(:show).and_return(@other_author)
       GroundColor.stub(:himlist).and_return([@gc, @gc, @gc])
       sign_in @user
     end
@@ -934,6 +964,10 @@ if MagicNumber['run_mode'] == 1
         assigns(:ground_colors).should have_at_least(3).items
       end
       context 'html形式' do
+        it '@paginateにページ制御を取得している' do
+          get :ground_colors, :id => @other_author.id
+          assigns(:paginate).is_a?(Kaminari::PaginatableArray).should be_true
+        end
         it 'ground_colorsテンプレートを描画する' do
           get :ground_colors, :id => @other_author.id
           response.should render_template("ground_colors")