OSDN Git Service

t#29510:
authoryasushiito <yas@pen-chan.jp>
Sat, 29 Sep 2012 08:31:34 +0000 (17:31 +0900)
committeryasushiito <yas@pen-chan.jp>
Sat, 29 Sep 2012 08:31:34 +0000 (17:31 +0900)
12 files changed:
app/controllers/comics_controller.rb
spec/models/artist_spec.rb
spec/models/author_spec.rb
spec/models/color_spec.rb
spec/models/comic_spec.rb
spec/models/ground_color_spec.rb
spec/models/ground_picture_spec.rb
spec/models/original_picture_spec.rb
spec/models/panel_color_spec.rb
spec/models/panel_picture_spec.rb
spec/models/panel_spec.rb
spec/models/story_spec.rb

index 3807717..3eda75e 100644 (file)
@@ -8,11 +8,6 @@ class ComicsController < ApplicationController
   before_filter :authenticate_admin!, :only => [:list, :browse]
 
   def top
-    @new_comics = Comic.find(:all, 
-      :include => :author, :conditions => ['visible > 0'], :order => 'updated_at desc', :limit => 5
-    )
-    @new_pictures = OriginalPicture.list @artist.id
-
     respond_to do |format|
       format.html # index.html.erb
     end
index 3bfff22..629097b 100644 (file)
@@ -172,10 +172,10 @@ describe Artist do
         @artist3 = FactoryGirl.create :artist, :author_id => @author.id, :name => 'artist3', :created_at => Time.now + 200
         @artist4 = FactoryGirl.create :artist, :author_id => @author.id, :name => 'artist4', :created_at => Time.now + 300
         @artist5 = FactoryGirl.create :artist, :author_id => @author.id, :name => 'artist5', :created_at => Time.now + 400
-        Artist.stub(:default_page_size).and_return(0)
+        Artist.stub(:default_page_size).and_return(2)
       end
       it '通常は全件(5件)を返す' do
-        r = Artist.list
+        r = Artist.list 5, 0
         r.should have(5).items 
       end
     end
index 3444f9a..1dbe0f5 100644 (file)
@@ -205,10 +205,10 @@ describe Author do
         @author5 = @other_user5.author
         @author5.created_at = Time.now + 400
         @author5.save
-        Author.stub(:default_page_size).and_return(0)
+        Author.stub(:default_page_size).and_return(2)
       end
       it '通常は全件(5件)を返す' do
-        r = Author.list
+        r = Author.list 5, 0
         r.should have(5).items 
       end
     end
index 5397f1f..e23354d 100644 (file)
@@ -190,10 +190,10 @@ describe Color do
         @color3 = FactoryGirl.create :color, :name => 'new color b', :t => 2
         @color4 = FactoryGirl.create :color, :name => 'new color c', :t => 3
         @color5 = FactoryGirl.create :color, :name => 'new color d', :t => 4
-        Color.stub(:default_page_size).and_return(0)
+        Color.stub(:default_page_size).and_return(2)
       end
       it '通常は全件(5件)を返す' do
-        r = Color.list
+        r = Color.list 5, 0
         r.should have(5).items 
       end
     end
index adf62c5..77712b4 100644 (file)
@@ -326,7 +326,7 @@ describe Comic do
         @comic3 = FactoryGirl.create :comic, :author_id => @author.id, :updated_at => Time.now + 200
         @comic4 = FactoryGirl.create :comic, :author_id => @author.id, :updated_at => Time.now + 300
         @comic5 = FactoryGirl.create :comic, :author_id => @author.id, :updated_at => Time.now + 400
-        Comic.stub(:default_page_size).and_return(2)
+        Author.stub(:default_comic_page_size).and_return(2)\r
       end
       it '通常は全件(5件)を返す' do
         r = Comic.mylist @author, 5, 0
index 1810457..35ae8d8 100644 (file)
@@ -177,6 +177,7 @@ describe GroundColor do
         @gc3 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 2, :color_id => @color.id, :updated_at => Time.now + 200
         @gc4 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 3, :color_id => @color.id, :updated_at => Time.now + 300
         @gc5 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 4, :color_id => @color.id, :updated_at => Time.now + 400
+        GroundColor.stub(:default_page_size).and_return(2)
       end
       it '通常は全件(5件)を返す' do
         r = GroundColor.list 5, 0
@@ -302,6 +303,7 @@ describe GroundColor do
         @gc3 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 2, :color_id => @color.id, :updated_at => Time.now + 200
         @gc4 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 3, :color_id => @color.id, :updated_at => Time.now + 300
         @gc5 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 4, :color_id => @color.id, :updated_at => Time.now + 400
+        Author.stub(:default_ground_color_page_size).and_return(2)\r
       end
       it '通常は全件(5件)を返す' do
         r = GroundColor.mylist @author, 5, 0
index a44c371..e2e449f 100644 (file)
@@ -177,6 +177,7 @@ describe GroundPicture do
         @gp3 = FactoryGirl.create :ground_picture, :panel_id => @panel.id, :z => 2, :picture_id => @p.id, :updated_at => Time.now + 200
         @gp4 = FactoryGirl.create :ground_picture, :panel_id => @panel.id, :z => 3, :picture_id => @p.id, :updated_at => Time.now + 300
         @gp5 = FactoryGirl.create :ground_picture, :panel_id => @panel.id, :z => 4, :picture_id => @p.id, :updated_at => Time.now + 400
+        GroundPicture.stub(:default_page_size).and_return(2)
       end
       it '通常は全件(5件)を返す' do
         r = GroundPicture.list 5, 0
@@ -323,6 +324,7 @@ describe GroundPicture do
         @gp3 = FactoryGirl.create :ground_picture, :panel_id => @panel.id, :z => 2, :picture_id => @p.id, :updated_at => Time.now + 200
         @gp4 = FactoryGirl.create :ground_picture, :panel_id => @panel.id, :z => 3, :picture_id => @p.id, :updated_at => Time.now + 300
         @gp5 = FactoryGirl.create :ground_picture, :panel_id => @panel.id, :z => 4, :picture_id => @p.id, :updated_at => Time.now + 400
+        Author.stub(:default_ground_picture_page_size).and_return(2)\r
       end
       it '通常は全件(5件)を返す' do
         r = GroundPicture.mylist @author, 5, 0
index c787b6f..4f8e135 100644 (file)
@@ -381,6 +381,7 @@ describe OriginalPicture do
         @op3 = FactoryGirl.create :original_picture, :artist_id => @artist.id, :updated_at => Time.now + 200
         @op4 = FactoryGirl.create :original_picture, :artist_id => @artist.id, :updated_at => Time.now + 300
         @op5 = FactoryGirl.create :original_picture, :artist_id => @artist.id, :updated_at => Time.now + 400
+        OriginalPicture.stub(:default_page_size).and_return(2)\r
       end
       it '通常は全件(5件)を返す' do
         r = OriginalPicture.mylist @artist, 5, 0
index 1e960de..07e6147 100644 (file)
@@ -188,6 +188,7 @@ describe PanelColor do
         @pc3 = FactoryGirl.create :panel_color, :panel_id => @panel.id, :z => 2, :updated_at => Time.now + 200
         @pc4 = FactoryGirl.create :panel_color, :panel_id => @panel.id, :z => 3, :updated_at => Time.now + 300
         @pc5 = FactoryGirl.create :panel_color, :panel_id => @panel.id, :z => 4, :updated_at => Time.now + 400
+        PanelColor.stub(:default_page_size).and_return(2)
       end
       it '通常は全件(5件)を返す' do
         r = PanelColor.list 5, 0
@@ -302,6 +303,7 @@ describe PanelColor do
         @pc3 = FactoryGirl.create :panel_color, :panel_id => @panel.id, :z => 2, :updated_at => Time.now + 200
         @pc4 = FactoryGirl.create :panel_color, :panel_id => @panel.id, :z => 3, :updated_at => Time.now + 300
         @pc5 = FactoryGirl.create :panel_color, :panel_id => @panel.id, :z => 4, :updated_at => Time.now + 400
+        Author.stub(:default_panel_color_page_size).and_return(2)\r
       end
       it '通常は全件(5件)を返す' do
         r = PanelColor.mylist @author, 5, 0
index 3a399c8..f9c1a28 100644 (file)
@@ -385,6 +385,7 @@ describe PanelPicture do
           :width => @p.width, :height => @p.height, :updated_at => Time.now + 300
         @npl5 = FactoryGirl.create :panel_picture, :panel_id => @panel.id, :t => 4, :picture_id => @p.id,
           :width => @p.width, :height => @p.height, :updated_at => Time.now + 400
+        PanelPicture.stub(:default_page_size).and_return(2)
       end
       it '通常は全件(5件)を返す' do
         r = PanelPicture.list 5, 0
@@ -544,6 +545,7 @@ describe PanelPicture do
           :width => @p.width, :height => @p.height, :updated_at => Time.now + 300
         @npl5 = FactoryGirl.create :panel_picture, :panel_id => @panel.id, :t => 4, :picture_id => @p.id,
           :width => @p.width, :height => @p.height, :updated_at => Time.now + 400
+        Author.stub(:default_panel_picture_page_size).and_return(2)\r
       end
       it '通常は全件(5件)を返す' do
         r = PanelPicture.mylist @author, 5, 0
index 01f9470..35147ad 100644 (file)
@@ -458,7 +458,7 @@ describe Panel do
         @npl3 = FactoryGirl.create :panel, :author_id => @author.id, :updated_at => Time.now + 200\r
         @npl4 = FactoryGirl.create :panel, :author_id => @author.id, :updated_at => Time.now + 300\r
         @npl5 = FactoryGirl.create :panel, :author_id => @author.id, :updated_at => Time.now + 400\r
-        Panel.stub(:default_page_size).and_return(2)\r
+        Author.stub(:default_panel_page_size).and_return(2)\r
       end
       it '通常は全件(5件)を返す' do
         r = Panel.mylist @author, 5, 0
index 31c1ecc..2b0ef00 100644 (file)
@@ -364,6 +364,7 @@ describe Story do
         @story3 = FactoryGirl.create :story, :author_id => @author.id, :comic_id => @comic.id, :panel_id => @panel.id, :t => 2, :updated_at => Time.now + 200
         @story4 = FactoryGirl.create :story, :author_id => @author.id, :comic_id => @comic.id, :panel_id => @panel.id, :t => 3, :updated_at => Time.now + 300
         @story5 = FactoryGirl.create :story, :author_id => @author.id, :comic_id => @comic.id, :panel_id => @panel.id, :t => 4, :updated_at => Time.now + 400
+        Author.stub(:default_story_size).and_return(2)\r
       end
       it '通常は全件(5件)を返す' do
         r = Story.mylist @author, 5, 0