X-Git-Url: http://git.osdn.net/view?p=pettanr%2Fpettanr.git;a=blobdiff_plain;f=spec%2Fmodels%2Fresource_picture_spec.rb;h=8fd9a97f2e690f5f68264b037536c47616e13405;hp=cccf4c47bc4d47061602ed6d70ae6489601bc5c1;hb=e6ae2d4d0e9cec1828ef7e4bec617d7f925d8133;hpb=2bcff4ea2e955de6c21e19239313f00ac323f410 diff --git a/spec/models/resource_picture_spec.rb b/spec/models/resource_picture_spec.rb index cccf4c47..8fd9a97f 100644 --- a/spec/models/resource_picture_spec.rb +++ b/spec/models/resource_picture_spec.rb @@ -474,21 +474,6 @@ describe ResourcePicture do end end - describe '一覧ページ制御に於いて' do - before do - ResourcePicture.stub(:count).with(any_args).and_return(100) - end - it 'ページ制御を返す' do - r = ResourcePicture.list_paginate - r.is_a?(Kaminari::PaginatableArray).should be_true - end - it 'ページ件数10のとき、3ページ目のオフセットは20から始まる' do - r = ResourcePicture.list_paginate 3, 10 - r.limit_value.should eq 10 - r.offset_value.should eq 20 - end - end - describe '自分の素材一覧取得に於いて' do before do @op = FactoryGirl.create :original_picture, :artist_id => @artist.id @@ -549,26 +534,6 @@ describe ResourcePicture do end end - describe '自分の素材一覧ページ制御に於いて' do - before do - ResourcePicture.stub(:count).with(any_args).and_return(100) - end - it 'ページ制御を返す' do - r = ResourcePicture.mylist_paginate @artist - r.is_a?(Kaminari::PaginatableArray).should be_true - end - it '自分の素材一覧の取得条件を利用している' do - ResourcePicture.stub(:mylist_where).with(any_args).and_return('') - ResourcePicture.should_receive(:mylist_where).with(any_args).exactly(1) - r = ResourcePicture.mylist_paginate @artist - end - it 'ページ件数10のとき、3ページ目のオフセットは20から始まる' do - r = ResourcePicture.mylist_paginate @artist, 3, 10 - r.limit_value.should eq 10 - r.offset_value.should eq 20 - end - end - describe '他作家の素材一覧取得に於いて' do before do @op = FactoryGirl.create :original_picture, :artist_id => @artist.id @@ -626,26 +591,61 @@ describe ResourcePicture do end end - describe '他作家の素材一覧ページ制御に於いて' do + describe '一覧ページ制御に於いて' do before do ResourcePicture.stub(:count).with(any_args).and_return(100) end it 'ページ制御を返す' do - r = ResourcePicture.himlist_paginate @artist + r = ResourcePicture.list_paginate + r.is_a?(Kaminari::PaginatableArray).should be_true + end + it 'ページ件数10のとき、3ページ目のオフセットは20から始まる' do + r = ResourcePicture.list_paginate 3, 10 + r.limit_value.should eq 10 + r.offset_value.should eq 20 + end + end + + describe '自分の素材一覧ページ制御に於いて' do + before do + ResourcePicture.stub(:count).with(any_args).and_return(100) + end + it 'ページ制御を返す' do + r = ResourcePicture.mylist_paginate @artist r.is_a?(Kaminari::PaginatableArray).should be_true end it '自分の素材一覧の取得条件を利用している' do + ResourcePicture.stub(:mylist_where).with(any_args).and_return('') + ResourcePicture.should_receive(:mylist_where).with(any_args).exactly(1) + r = ResourcePicture.mylist_paginate @artist + end + it 'ページ件数10のとき、3ページ目のオフセットは20から始まる' do + r = ResourcePicture.mylist_paginate @artist, 3, 10 + r.limit_value.should eq 10 + r.offset_value.should eq 20 + end + end + + describe '他作家の素材一覧ページ制御に於いて' do + before do + ResourcePicture.stub(:count).with(any_args).and_return(100) + end + it 'ページ制御を返す' do + r = ResourcePicture.himlist_paginate @other_artist + r.is_a?(Kaminari::PaginatableArray).should be_true + end + it '他作家の素材一覧の取得条件を利用している' do ResourcePicture.stub(:himlist_where).with(any_args).and_return('') ResourcePicture.should_receive(:himlist_where).with(any_args).exactly(1) - r = ResourcePicture.himlist_paginate @artist + r = ResourcePicture.himlist_paginate @other_artist end it 'ページ件数10のとき、3ページ目のオフセットは20から始まる' do - r = ResourcePicture.himlist_paginate @artist, 3, 10 + r = ResourcePicture.himlist_paginate @other_artist, 3, 10 r.limit_value.should eq 10 r.offset_value.should eq 20 end end - + describe '一覧取得オプションに於いて' do it '3つの項目を含んでいる' do r = ResourcePicture.list_opt