end
end
- describe '画像タグオプションに於いて' do
+ describe 'サムネイル画像タグオプションに於いて' do
before do
@op = FactoryGirl.create :original_picture, :artist_id => @artist.id
OriginalPicture.any_instance.stub(:url).and_return('/original_pictures/3.gif')
end
it 'サムネイル画像の幅高さ取得を依頼している' do
PettanImager.should_receive(:thumbnail_size).with(any_args).exactly(1)
- @op.opt_img_tag
+ @op.tmb_opt_img_tag
+ end
+ it '戻り値はHashで返す' do
+ r = @op.tmb_opt_img_tag
+ r.is_a?(Hash).should be_true
+ end
+ it 'srcキーを含んでいる' do
+ r = @op.tmb_opt_img_tag
+ r.has_key?(:src).should be_true
+ r[:src].should eq '/original_pictures/3.gif'
+ end
+ it 'widthキーを含んでいる' do
+ r = @op.tmb_opt_img_tag
+ r.has_key?(:width).should be_true
+ r[:width].should eq 40
+ end
+ it 'heightキーを含んでいる' do
+ r = @op.tmb_opt_img_tag
+ r.has_key?(:height).should be_true
+ r[:height].should eq 30
+ end
+ end
+
+ describe '画像タグオプションに於いて' do
+ before do
+ @op = FactoryGirl.create :original_picture, :artist_id => @artist.id
+ OriginalPicture.any_instance.stub(:url).and_return('/original_pictures/3.gif')
end
it '戻り値はHashで返す' do
r = @op.opt_img_tag
it 'widthキーを含んでいる' do
r = @op.opt_img_tag
r.has_key?(:width).should be_true
- r[:width].should eq 40
+ r[:width].should eq @op.width
end
it 'heightキーを含んでいる' do
r = @op.opt_img_tag
r.has_key?(:height).should be_true
- r[:height].should eq 30
+ r[:height].should eq @op.height
end
end
end
describe 'json一覧出力オプションに於いて' do
before do
- @op = FactoryGirl.create :original_picture, :artist_id => @artist.id\r
- @p = FactoryGirl.create :picture, :original_picture_id => @op.id, :license_id => @license.id, :artist_id => @artist.id\r
- @rp = FactoryGirl.create :resource_picture, :artist_id => @artist.id, :license_id => @license.id, :original_picture_id => @op.id, :picture_id => @p.id\r
- @sbt = FactoryGirl.create :speech_balloon_template\r
+ @op = FactoryGirl.create :original_picture, :artist_id => @artist.id
+ @p = FactoryGirl.create :picture, :original_picture_id => @op.id, :license_id => @license.id, :artist_id => @artist.id
+ @rp = FactoryGirl.create :resource_picture, :artist_id => @artist.id, :license_id => @license.id, :original_picture_id => @op.id, :picture_id => @p.id
+ @sbt = FactoryGirl.create :speech_balloon_template
@comic = FactoryGirl.create :comic, :author_id => @author.id, :visible => 1
@panel = FactoryGirl.create :panel, :author_id => @author.id, :publish => 1
@story = FactoryGirl.create :story, :author_id => @author.id, :comic_id => @comic.id, :panel_id => @panel.id
@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
+ OriginalPicture.stub(:default_page_size).and_return(2)
end
it '通常は全件(5件)を返す' do
r = OriginalPicture.mylist @artist, 5, 0
end
describe 'json単体出力オプションに於いて' do
before do
- @op = FactoryGirl.create :original_picture, :artist_id => @artist.id\r
- @p = FactoryGirl.create :picture, :original_picture_id => @op.id, :license_id => @license.id, :artist_id => @artist.id\r
- @rp = FactoryGirl.create :resource_picture, :artist_id => @artist.id, :license_id => @license.id, :original_picture_id => @op.id, :picture_id => @p.id\r
- @sbt = FactoryGirl.create :speech_balloon_template\r
+ @op = FactoryGirl.create :original_picture, :artist_id => @artist.id
+ @p = FactoryGirl.create :picture, :original_picture_id => @op.id, :license_id => @license.id, :artist_id => @artist.id
+ @rp = FactoryGirl.create :resource_picture, :artist_id => @artist.id, :license_id => @license.id, :original_picture_id => @op.id, :picture_id => @p.id
+ @sbt = FactoryGirl.create :speech_balloon_template
@comic = FactoryGirl.create :comic, :author_id => @author.id, :visible => 1
@panel = FactoryGirl.create :panel, :author_id => @author.id, :publish => 1
@story = FactoryGirl.create :story, :author_id => @author.id, :comic_id => @comic.id, :panel_id => @panel.id