OSDN Git Service

t#31470:create pager
[pettanr/pettanr.git] / spec / models / resource_picture_spec.rb
index cccf4c4..8fd9a97 100644 (file)
@@ -474,21 +474,6 @@ describe ResourcePicture do
     end\r
   end\r
   \r
-  describe '一覧ページ制御に於いて' do\r
-    before do\r
-      ResourcePicture.stub(:count).with(any_args).and_return(100)\r
-    end\r
-    it 'ページ制御を返す' do\r
-      r = ResourcePicture.list_paginate\r
-      r.is_a?(Kaminari::PaginatableArray).should be_true\r
-    end\r
-    it 'ページ件数10のとき、3ページ目のオフセットは20から始まる' do\r
-      r = ResourcePicture.list_paginate 3, 10\r
-      r.limit_value.should eq 10\r
-      r.offset_value.should eq 20\r
-    end\r
-  end\r
-  \r
   describe '自分の素材一覧取得に於いて' do\r
     before do\r
       @op = FactoryGirl.create :original_picture, :artist_id => @artist.id\r
@@ -549,26 +534,6 @@ describe ResourcePicture do
     end\r
   end\r
   \r
-  describe '自分の素材一覧ページ制御に於いて' do\r
-    before do\r
-      ResourcePicture.stub(:count).with(any_args).and_return(100)\r
-    end\r
-    it 'ページ制御を返す' do\r
-      r = ResourcePicture.mylist_paginate @artist\r
-      r.is_a?(Kaminari::PaginatableArray).should be_true\r
-    end\r
-    it '自分の素材一覧の取得条件を利用している' do\r
-      ResourcePicture.stub(:mylist_where).with(any_args).and_return('')\r
-      ResourcePicture.should_receive(:mylist_where).with(any_args).exactly(1)\r
-      r = ResourcePicture.mylist_paginate @artist\r
-    end\r
-    it 'ページ件数10のとき、3ページ目のオフセットは20から始まる' do\r
-      r = ResourcePicture.mylist_paginate @artist, 3, 10\r
-      r.limit_value.should eq 10\r
-      r.offset_value.should eq 20\r
-    end\r
-  end\r
-\r
   describe '他作家の素材一覧取得に於いて' do\r
     before do\r
       @op = FactoryGirl.create :original_picture, :artist_id => @artist.id\r
@@ -626,26 +591,61 @@ describe ResourcePicture do
     end\r
   end\r
   \r
-  describe 'ä»\96ä½\9c家ã\81®ç´ æ\9d\90ä¸\80覧ã\83\9aã\83¼ã\82¸å\88¶å¾¡ã\81«æ\96¼ã\81\84ã\81¦' do\r
+  describe '一覧ページ制御に於いて' do\r
     before do\r
       ResourcePicture.stub(:count).with(any_args).and_return(100)\r
     end\r
     it 'ページ制御を返す' do\r
-      r = ResourcePicture.himlist_paginate @artist\r
+      r = ResourcePicture.list_paginate\r
+      r.is_a?(Kaminari::PaginatableArray).should be_true\r
+    end\r
+    it 'ページ件数10のとき、3ページ目のオフセットは20から始まる' do\r
+      r = ResourcePicture.list_paginate 3, 10\r
+      r.limit_value.should eq 10\r
+      r.offset_value.should eq 20\r
+    end\r
+  end\r
+  \r
+  describe '自分の素材一覧ページ制御に於いて' do\r
+    before do\r
+      ResourcePicture.stub(:count).with(any_args).and_return(100)\r
+    end\r
+    it 'ページ制御を返す' do\r
+      r = ResourcePicture.mylist_paginate @artist\r
       r.is_a?(Kaminari::PaginatableArray).should be_true\r
     end\r
     it '自分の素材一覧の取得条件を利用している' do\r
+      ResourcePicture.stub(:mylist_where).with(any_args).and_return('')\r
+      ResourcePicture.should_receive(:mylist_where).with(any_args).exactly(1)\r
+      r = ResourcePicture.mylist_paginate @artist\r
+    end\r
+    it 'ページ件数10のとき、3ページ目のオフセットは20から始まる' do\r
+      r = ResourcePicture.mylist_paginate @artist, 3, 10\r
+      r.limit_value.should eq 10\r
+      r.offset_value.should eq 20\r
+    end\r
+  end\r
+  \r
+  describe '他作家の素材一覧ページ制御に於いて' do\r
+    before do\r
+      ResourcePicture.stub(:count).with(any_args).and_return(100)\r
+    end\r
+    it 'ページ制御を返す' do\r
+      r = ResourcePicture.himlist_paginate @other_artist\r
+      r.is_a?(Kaminari::PaginatableArray).should be_true\r
+    end\r
+    it '他作家の素材一覧の取得条件を利用している' do\r
       ResourcePicture.stub(:himlist_where).with(any_args).and_return('')\r
       ResourcePicture.should_receive(:himlist_where).with(any_args).exactly(1)\r
-      r = ResourcePicture.himlist_paginate @artist\r
+      r = ResourcePicture.himlist_paginate @other_artist\r
     end\r
     it 'ページ件数10のとき、3ページ目のオフセットは20から始まる' do\r
-      r = ResourcePicture.himlist_paginate @artist, 3, 10\r
+      r = ResourcePicture.himlist_paginate @other_artist, 3, 10\r
       r.limit_value.should eq 10\r
       r.offset_value.should eq 20\r
     end\r
   end\r
-\r
+  \r
   describe '一覧取得オプションに於いて' do\r
     it '3つの項目を含んでいる' do\r
       r = ResourcePicture.list_opt\r