@comic = Factory.build :normal_comic, :author_id => @author.id, :width => 0
@comic.should_not be_valid
end
- it 'è² ã\81§ã\81¯é\80\9aる' do
+ it 'è² ã\81§ã\82\82失æ\95\97ã\81\99る' do
@comic = Factory.build :normal_comic, :author_id => @author.id, :width => -1
- @comic.should be_valid
+ @comic.should_not be_valid
end
it '正なら通る' do
@comic = Factory.build :normal_comic, :author_id => @author.id, :width => 1
@comic = Factory.build :normal_comic, :author_id => @author.id, :height => 0
@comic.should_not be_valid
end
- it 'è² ã\81§ã\81¯é\80\9aる' do
+ it 'è² ã\81§ã\82\82失æ\95\97ã\81\99る' do
@comic = Factory.build :normal_comic, :author_id => @author.id, :height => -1
- @comic.should be_valid
+ @comic.should_not be_valid
end
it '正なら通る' do
@comic = Factory.build :normal_comic, :author_id => @author.id, :height => 1
@comic = Factory :normal_comic, :author_id => @author.id
end
it '指定のコミックを返す' do
- c = Comic.show @comic.id
+ c = Comic.show @comic.id, @author.id
c.should eq @comic
end
context '関連テーブルオプションがないとき' 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