OSDN Git Service

t#28845:time sort test repair
authoryasushiito <yas@pen-chan.jp>
Sat, 30 Jun 2012 02:07:39 +0000 (11:07 +0900)
committeryasushiito <yas@pen-chan.jp>
Sat, 30 Jun 2012 02:07:39 +0000 (11:07 +0900)
spec/models/artist_spec.rb
spec/models/comic_spec.rb
spec/models/original_picture_spec.rb
spec/models/panel_spec.rb
spec/models/resource_picture_spec.rb

index 42bb737..3abe223 100644 (file)
@@ -94,16 +94,16 @@ describe Artist do
       c.should eq [@artist]
     end
     it '時系列で並んでいる' do
-      n = Factory :artist, :author_id => @author.id, :name => 'artist'
+      n = Factory :artist, :author_id => @author.id, :name => 'artist', :updated_at => Time.now + 100
       l = Artist.list
       l.should eq [n, @artist]
     end
     context 'DBに5件あって1ページの件数を2件に変えたとして' do
       before do
-        @artist2 = Factory :artist, :author_id => @author.id, :name => 'artist2'
-        @artist3 = Factory :artist, :author_id => @author.id, :name => 'artist3'
-        @artist4 = Factory :artist, :author_id => @author.id, :name => 'artist4'
-        @artist5 = Factory :artist, :author_id => @author.id, :name => 'artist5'
+        @artist2 = Factory :artist, :author_id => @author.id, :name => 'artist2', :updated_at => Time.now + 100
+        @artist3 = Factory :artist, :author_id => @author.id, :name => 'artist3', :updated_at => Time.now + 200
+        @artist4 = Factory :artist, :author_id => @author.id, :name => 'artist4', :updated_at => Time.now + 300
+        @artist5 = Factory :artist, :author_id => @author.id, :name => 'artist5', :updated_at => Time.now + 400
         Artist.stub(:default_page_size).and_return(2)
       end
       it '通常は2件を返す' do
index 599f943..36aa921 100644 (file)
@@ -216,16 +216,16 @@ describe Comic do
       c.should eq [@comic]
     end
     it '時系列で並んでいる' do
-      v = Factory :visible_comic, :author_id => @author.id
+      v = Factory :visible_comic, :author_id => @author.id, :updated_at => Time.now + 100
       c = Comic.list
       c.should eq [v, @comic]
     end
     context 'DBに5件あって1ページの件数を2件に変えたとして' do
       before do
-        @comic2 = Factory :visible_comic, :author_id => @author.id
-        @comic3 = Factory :editable_comic, :author_id => @author.id
-        @comic4 = Factory :normal_comic, :author_id => @author.id
-        @comic5 = Factory :editable_comic, :author_id => @author.id
+        @comic2 = Factory :visible_comic, :author_id => @author.id, :updated_at => Time.now + 100
+        @comic3 = Factory :editable_comic, :author_id => @author.id, :updated_at => Time.now + 200
+        @comic4 = Factory :normal_comic, :author_id => @author.id, :updated_at => Time.now + 300
+        @comic5 = Factory :editable_comic, :author_id => @author.id, :updated_at => Time.now + 400
         Comic.stub(:default_page_size).and_return(2)
       end
       it '通常は2件を返す' do
index f61ef84..f8c8f7c 100644 (file)
@@ -269,16 +269,16 @@ describe OriginalPicture do
       pic.should eq [@op]
     end
     it '時系列で並んでいる' do
-      newpic = Factory :original_picture, :artist_id => @artist.id
+      newpic = Factory :original_picture, :artist_id => @artist.id, :updated_at => Time.now + 100
       pic = OriginalPicture.list @artist.id
       pic.should eq [newpic, @op]
     end
     context 'DBに5件あって1ページの件数を2件に変えたとして' do
       before do
-        @op2 = Factory :original_picture, :artist_id => @artist.id
-        @op3 = Factory :original_picture, :artist_id => @artist.id
-        @op4 = Factory :original_picture, :artist_id => @artist.id
-        @op5 = Factory :original_picture, :artist_id => @artist.id
+        @op2 = Factory :original_picture, :artist_id => @artist.id, :updated_at => Time.now + 100
+        @op3 = Factory :original_picture, :artist_id => @artist.id, :updated_at => Time.now + 200
+        @op4 = Factory :original_picture, :artist_id => @artist.id, :updated_at => Time.now + 300
+        @op5 = Factory :original_picture, :artist_id => @artist.id, :updated_at => Time.now + 400
         OriginalPicture.stub(:default_page_size).and_return(2)
       end
       it '通常は2件を返す' do
index 0ec0e91..76996f9 100644 (file)
@@ -517,16 +517,16 @@ describe Panel do
       pl.should eq [@panel]\r
     end\r
     it '時系列で並んでいる' do\r
-      npl = Factory :panel, :comic_id => @comic.id, :author_id => @author.id, :t => 1\r
+      npl = Factory :panel, :comic_id => @comic.id, :author_id => @author.id, :t => 1, :updated_at => Time.now + 100\r
       pl = Panel.list\r
       pl.should eq [npl, @panel]\r
     end\r
     context 'DBに5件あって1ページの件数を2件に変えたとして' do\r
       before do\r
-        @npl2 = Factory :panel, :comic_id => @comic.id, :author_id => @author.id, :t => 1\r
-        @npl3 = Factory :panel, :comic_id => @comic.id, :author_id => @author.id, :t => 2\r
-        @npl4 = Factory :panel, :comic_id => @comic.id, :author_id => @author.id, :t => 3\r
-        @npl5 = Factory :panel, :comic_id => @comic.id, :author_id => @author.id, :t => 4\r
+        @npl2 = Factory :panel, :comic_id => @comic.id, :author_id => @author.id, :t => 1, :updated_at => Time.now + 100\r
+        @npl3 = Factory :panel, :comic_id => @comic.id, :author_id => @author.id, :t => 2, :updated_at => Time.now + 200\r
+        @npl4 = Factory :panel, :comic_id => @comic.id, :author_id => @author.id, :t => 3, :updated_at => Time.now + 300\r
+        @npl5 = Factory :panel, :comic_id => @comic.id, :author_id => @author.id, :t => 4, :updated_at => Time.now + 400\r
         Panel.stub(:default_page_size).and_return(2)\r
       end\r
       it '通常は2件を返す' do\r
index 76e117c..9d91f1f 100644 (file)
@@ -279,20 +279,20 @@ describe ResourcePicture do
     end
     it '時系列で並んでいる' do
       nop = Factory :original_picture, :artist_id => @artist.id, :license_id => @license.id
-      nrp = Factory :resource_picture, :artist_id => @artist.id, :license_id => @license.id, :original_picture_id => nop.id
+      nrp = Factory :resource_picture, :artist_id => @artist.id, :license_id => @license.id, :original_picture_id => nop.id, :updated_at => Time.now + 100
       pic = ResourcePicture.list
       pic.should eq [nrp, @rp]
     end
     context 'DBに5件あって1ページの件数を2件に変えたとして' do
       before do
         nop2 = Factory :original_picture, :artist_id => @artist.id, :license_id => @license.id
-        @nrp2 = Factory :resource_picture, :artist_id => @artist.id, :license_id => @license.id, :original_picture_id => nop2.id
+        @nrp2 = Factory :resource_picture, :artist_id => @artist.id, :license_id => @license.id, :original_picture_id => nop2.id, :updated_at => Time.now + 100
         nop3 = Factory :original_picture, :artist_id => @artist.id, :license_id => @license.id
-        @nrp3 = Factory :resource_picture, :artist_id => @artist.id, :license_id => @license.id, :original_picture_id => nop3.id
+        @nrp3 = Factory :resource_picture, :artist_id => @artist.id, :license_id => @license.id, :original_picture_id => nop3.id, :updated_at => Time.now + 200
         nop4 = Factory :original_picture, :artist_id => @artist.id, :license_id => @license.id
-        @nrp4 = Factory :resource_picture, :artist_id => @artist.id, :license_id => @license.id, :original_picture_id => nop4.id
+        @nrp4 = Factory :resource_picture, :artist_id => @artist.id, :license_id => @license.id, :original_picture_id => nop4.id, :updated_at => Time.now + 300
         nop5 = Factory :original_picture, :artist_id => @artist.id, :license_id => @license.id
-        @nrp5 = Factory :resource_picture, :artist_id => @artist.id, :license_id => @license.id, :original_picture_id => nop5.id
+        @nrp5 = Factory :resource_picture, :artist_id => @artist.id, :license_id => @license.id, :original_picture_id => nop5.id, :updated_at => Time.now + 400
         ResourcePicture.stub(:default_page_size).and_return(2)
       end
       it '通常は2件を返す' do