end
def self.list_opt
- {:include => {:author => {}, :original_pictures => {}, :pictures => {}, :resource_pictures => {}} }
+ {:include => {:author => {}} }
end
def self.list_json_opt
- {:include => {:author => {}, :original_pictures => {}, :pictures => {}, :resource_pictures => {}} }
+ {:include => {:author => {}} }
end
def self.show aid, au
end
def self.show_opt
- {:include => {:author => {}, :original_pictures => {}, :pictures => {}, :resource_pictures => {}} }
+ {:include => {:author => {}} }
end
def self.show_json_opt
- {:include => {:author => {}, :original_pictures => {}, :pictures => {}, :resource_pictures => {}} }
+ {:include => {:author => {}} }
end
def self.visible_count
end
def self.list_json_opt
- {:include => {:stories => {:panel => {}}, :author => {}}}
+ {:include => {:stories => {:include => {:panel => {}}}, :author => {}}}
end
def self.mylist au, page = 1, page_size = Author.default_comic_page_size
end
def self.show_json_opt
- {:include => {:stories => {:panel => {}}, :author => {}}}
+ {:include => {:stories => {:include => {:panel => {}}}, :author => {}}}
end
def self.visible_count
end
def self.list_json_opt
- {:include => {:panel => {:author => {}}, :color => {} }}
+ {:include => {:panel => {:include => {:author => {}}}, :color => {} }}
end
def self.mylist au, page = 1, page_size = Author.default_ground_color_page_size
end
def self.list_json_opt
- {:include => {:panel => {:author => {}}, :picture => {:artist => {}, :license => {}}}}
+ {:include => {:panel => {:include => {:author => {}}}, :picture => {:include => {:artist => {}, :license => {}}} }}
end
def self.mylist au, page = 1, page_size = Author.default_ground_picture_page_size
end
def self.list_json_opt
- {:include => {:panel => {:author => {}} }}
+ {:include => {:panel => {:include => {:author => {}}} }}
end
def self.mylist au, page = 1, page_size = Author.default_panel_color_page_size
end
def self.list_json_opt
- {:include => {:panel => {:author => {}}, :picture => {:artist => {}, :license => {}}}}
+ {:include => {:panel => {:include => {:author => {}}}, :picture => {:include => {:artist => {}, :license => {}}} }}
end
def self.mylist au, page = 1, page_size = Author.default_panel_picture_page_size
r = Artist.list_opt
r.has_key?(:include).should be_true
end
- it '4つの項目を含んでいる' do
+ it '1つの項目を含んでいる' do
r = Artist.list_opt[:include]
- r.should have(4).items
+ r.should have(1).items
end
it '作家を含んでいる' do
r = Artist.list_opt[:include]
r.has_key?(:author).should be_true
end
- it '原画を含んでいる' do
- r = Artist.list_opt[:include]
- r.has_key?(:original_pictures).should be_true
- end
- it '実素材を含んでいる' do
- r = Artist.list_opt[:include]
- r.has_key?(:pictures).should be_true
- end
- it '素材を含んでいる' do
- r = Artist.list_opt[:include]
- r.has_key?(:resource_pictures).should be_true
- end
end
describe 'json一覧出力オプションに於いて' do
- it 'includeキーを含んでいる' do
- r = Artist.list_json_opt
- r.has_key?(:include).should be_true
- end
- it '4つの項目を含んでいる' do
- r = Artist.list_json_opt[:include]
- r.should have(4).items
+ before do
+ @artist = FactoryGirl.create :artist, :author_id => @author.id
end
it '作家を含んでいる' do
- r = Artist.list_json_opt[:include]
- r.has_key?(:author).should be_true
- end
- it '原画を含んでいる' do
- r = Artist.list_json_opt[:include]
- r.has_key?(:original_pictures).should be_true
- end
- it '実素材を含んでいる' do
- r = Artist.list_json_opt[:include]
- r.has_key?(:pictures).should be_true
- end
- it '素材を含んでいる' do
- r = Artist.list_json_opt[:include]
- r.has_key?(:resource_pictures).should be_true
+ r = Artist.list.to_json Artist.list_json_opt
+ j = JSON.parse r
+ i = j.first
+ i.has_key?('author').should be_true
end
end
r = Artist.show_opt
r.has_key?(:include).should be_true
end
- it '4つの項目を含んでいる' do
- r = Artist.show_opt[:include]
- r.should have(4).items
- end
- it '作家を含んでいる' do
+ it '1つの項目を含んでいる' do
r = Artist.show_opt[:include]
- r.has_key?(:author).should be_true
- end
- it '原画を含んでいる' do
- r = Artist.show_opt[:include]
- r.has_key?(:original_pictures).should be_true
- end
- it '実素材を含んでいる' do
- r = Artist.show_opt[:include]
- r.has_key?(:pictures).should be_true
- end
- it '素材を含んでいる' do
- r = Artist.show_opt[:include]
- r.has_key?(:resource_pictures).should be_true
+ r.should have(1).items
end
end
describe 'json単体出力オプションに於いて' do
- it 'includeキーを含んでいる' do
- r = Artist.show_json_opt
- r.has_key?(:include).should be_true
- end
- it '4つの項目を含んでいる' do
- r = Artist.show_json_opt[:include]
- r.should have(4).items
+ before do
+ @artist = FactoryGirl.create :artist, :author_id => @author.id
end
it '作家を含んでいる' do
- r = Artist.show_json_opt[:include]
- r.has_key?(:author).should be_true
- end
- it '原画を含んでいる' do
- r = Artist.show_json_opt[:include]
- r.has_key?(:original_pictures).should be_true
- end
- it '実素材を含んでいる' do
- r = Artist.show_json_opt[:include]
- r.has_key?(:pictures).should be_true
- end
- it '素材を含んでいる' do
- r = Artist.show_json_opt[:include]
- r.has_key?(:resource_pictures).should be_true
+ r = Artist.show(@artist.id, @author).to_json Artist.show_json_opt
+ j = JSON.parse r
+ i = j
+ i.has_key?('author').should be_true
end
end
end
end
end
describe 'json一覧出力オプションに於いて' do
- it 'includeキーを含んでいる' do
- r = Author.list_json_opt
- r.has_key?(:include).should be_true
- end
- it '1つの項目を含んでいる' do
- r = Author.list_json_opt[:include]
- r.should have(1).items
+ before do
+ @artist = FactoryGirl.create :artist_yas, :author_id => @author.id
end
it '絵師を含んでいる' do
- r = Author.list_json_opt[:include]
- r.has_key?(:artist).should be_true
+ r = Author.list.to_json Author.list_json_opt
+ j = JSON.parse r
+ i = j.first
+ i.has_key?('artist').should be_true
end
end
end
end
describe 'json単体出力オプションに於いて' do
- it 'includeキーを含んでいる' do
- r = Author.show_json_opt
- r.has_key?(:include).should be_true
- end
- it '1つの項目を含んでいる' do
- r = Author.show_json_opt[:include]
- r.should have(1).items
+ before do
+ @artist = FactoryGirl.create :artist_yas, :author_id => @author.id
end
it '絵師を含んでいる' do
- r = Author.show_json_opt[:include]
- r.has_key?(:artist).should be_true
+ r = Author.show(@author.id, @author).to_json Author.show_json_opt
+ j = JSON.parse r
+ i = j
+ i.has_key?('artist').should be_true
end
end
end
end
end
- describe 'list関連テーブルプションに於いて' do
+ describe '一覧取得オプションに於いて' do
it 'includeキーを含んでいる' do
r = Comic.list_opt
r.has_key?(:include).should be_true
end
end
describe 'json一覧出力オプションに於いて' do
- it 'includeキーを含んでいる' do
- r = Comic.list_json_opt
- r.has_key?(:include).should be_true
- end
- it '2つの項目を含んでいる' do
- r = Comic.list_json_opt[:include]
- r.should have(2).items
+ 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
+ @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
end
it 'ストーリーを含んでいる' do
- r = Comic.list_json_opt[:include]
- r.has_key?(:stories).should be_true
+ r = Comic.list.to_json Comic.list_json_opt
+ j = JSON.parse r
+ i = j.first
+ i.has_key?('stories').should be_true
end
it 'ストーリーはコマを含んでいる' do
- r = Comic.list_json_opt[:include]
- r[:stories].has_key?(:panel).should be_true
+ r = Comic.list.to_json Comic.list_json_opt
+ j = JSON.parse r
+ i = j.first
+ s = i['stories'].first
+ s.has_key?('panel').should be_true
end
it '作家を含んでいる' do
- r = Comic.list_json_opt[:include]
- r.has_key?(:author).should be_true
+ r = Comic.list.to_json Comic.list_json_opt
+ j = JSON.parse r
+ i = j.first
+ i.has_key?('author').should be_true
end
end
end
end
end
- describe '関連テーブルプションに於いて' do
+ describe '単体取得オプションに於いて' do
it 'includeキーを含んでいる' do
r = Comic.show_opt
r.has_key?(:include).should be_true
end
end
describe 'json単体出力オプションに於いて' do
- it 'includeキーを含んでいる' do
- r = Comic.show_json_opt
- r.has_key?(:include).should be_true
- end
- it '2つの項目を含んでいる' do
- r = Comic.show_json_opt[:include]
- r.should have(2).items
- end
- it '作家を含んでいる' do
- r = Comic.show_json_opt[:include]
- r.has_key?(:author).should be_true
+ 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
+ @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
end
it 'ストーリーを含んでいる' do
- r = Comic.show_json_opt[:include]
- r.has_key?(:stories).should be_true
+ r = Comic.show(@comic.id, @author).to_json Comic.show_json_opt
+ j = JSON.parse r
+ i = j
+ i.has_key?('stories').should be_true
end
it 'ストーリーはコマを含んでいる' do
- r = Comic.show_json_opt[:include]
- r[:stories].has_key?(:panel).should be_true
+ r = Comic.show(@comic.id, @author).to_json Comic.show_json_opt
+ j = JSON.parse r
+ i = j
+ s = i['stories'].first
+ s.has_key?('panel').should be_true
end
+ it '作家を含んでいる' do
+ r = Comic.show(@comic.id, @author).to_json Comic.show_json_opt
+ j = JSON.parse r
+ i = j
+ i.has_key?('author').should be_true
+ end
end
end
end
end
- describe 'list関連テーブルプションに於いて' do
+ describe '一覧取得オプションに於いて' do
it 'includeキーを含んでいる' do
r = GroundColor.list_opt
r.has_key?(:include).should be_true
end
end
describe 'json一覧出力オプションに於いて' do
- it 'includeキーを含んでいる' do
- r = GroundColor.list_json_opt
- r.has_key?(:include).should be_true
- end
- it '2つの項目を含んでいる' do
- r = GroundColor.list_json_opt[:include]
- r.should have(2).items
+ 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
+ @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
+ @gc = FactoryGirl.create :ground_color, :panel_id => @panel.id, :color_id => @color.id
end
it 'コマを含んでいる' do
- r = GroundColor.list_json_opt[:include]
- r.has_key?(:panel).should be_true
+ r = GroundColor.list.to_json GroundColor.list_json_opt
+ j = JSON.parse r
+ i = j.first
+ i.has_key?('panel').should be_true
end
it 'コマは作家を含んでいる' do
- r = GroundColor.list_json_opt[:include]
- r[:panel].has_key?(:author).should be_true
+ r = GroundColor.list.to_json GroundColor.list_json_opt
+ j = JSON.parse r
+ i = j.first
+ s = i['panel']
+ s.has_key?('author').should be_true
end
it '色を含んでいる' do
- r = GroundColor.list_json_opt[:include]
- r.has_key?(:color).should be_true
+ r = GroundColor.list.to_json GroundColor.list_json_opt
+ j = JSON.parse r
+ i = j.first
+ i.has_key?('color').should be_true
end
end
end
end
end
- describe 'list関連テーブルプションに於いて' do
+ describe '一覧取得オプションに於いて' do
it 'includeキーを含んでいる' do
r = GroundPicture.list_opt
r.has_key?(:include).should be_true
end
end
describe 'json一覧出力オプションに於いて' do
- it 'includeキーを含んでいる' do
- r = GroundPicture.list_json_opt
- r.has_key?(:include).should be_true
- end
- it '2つの項目を含んでいる' do
- r = GroundPicture.list_json_opt[:include]
- r.should have(2).items
+ 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
+ @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
+ @gp = FactoryGirl.create :ground_picture, :panel_id => @panel.id, :picture_id => @p.id
end
it 'コマを含んでいる' do
- r = GroundPicture.list_json_opt[:include]
- r.has_key?(:panel).should be_true
+ r = GroundPicture.list.to_json GroundPicture.list_json_opt
+ j = JSON.parse r
+ i = j.first
+ i.has_key?('panel').should be_true
end
it 'コマは作家を含んでいる' do
- r = GroundPicture.list_json_opt[:include]
- r[:panel].has_key?(:author).should be_true
+ r = GroundPicture.list.to_json GroundPicture.list_json_opt
+ j = JSON.parse r
+ i = j.first
+ s = i['panel']
+ s.has_key?('author').should be_true
end
it '実素材を含んでいる' do
- r = GroundPicture.list_json_opt[:include]
- r.has_key?(:picture).should be_true
+ r = GroundPicture.list.to_json GroundPicture.list_json_opt
+ j = JSON.parse r
+ i = j.first
+ i.has_key?('picture').should be_true
end
it '実素材は絵師を含んでいる' do
- r = GroundPicture.list_json_opt[:include]
- r[:picture].has_key?(:artist).should be_true
+ r = GroundPicture.list.to_json GroundPicture.list_json_opt
+ j = JSON.parse r
+ i = j.first
+ s = i['picture']
+ s.has_key?('artist').should be_true
end
it '実素材はライセンスを含んでいる' do
- r = GroundPicture.list_json_opt[:include]
- r[:picture].has_key?(:license).should be_true
+ r = GroundPicture.list.to_json GroundPicture.list_json_opt
+ j = JSON.parse r
+ i = j.first
+ s = i['picture']
+ s.has_key?('license').should be_true
end
end
l.should eq [@lg, @lg2]
end
end
- describe 'list関連テーブルプションに於いて' do
+ describe '一覧取得オプションに於いて' do
it 'includeキーを含んでいる' do
r = LicenseGroup.list_opt
r.has_key?(:include).should be_true
end
end
describe 'json一覧出力オプションに於いて' do
- it 'includeキーを含んでいる' do
- r = LicenseGroup.list_json_opt
- r.has_key?(:include).should be_true
- end
- it '1つの項目を含んでいる' do
- r = LicenseGroup.list_json_opt[:include]
- r.should have(1).items
+ before do
+ @sp = FactoryGirl.create :system_picture
+ @lg = FactoryGirl.create :license_group
+ @license = FactoryGirl.create :license, :license_group_id => @lg.id, :system_picture_id => @sp.id
+ @user = FactoryGirl.create( :user_yas)
+ @author = @user.author
+ @artist = FactoryGirl.create :artist_yas, :author_id => @author.id
+ @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
+ @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
end
it 'ライセンスを含んでいる' do
- r = LicenseGroup.list_json_opt[:include]
- r.has_key?(:licenses).should be_true
+ r = LicenseGroup.list.to_json LicenseGroup.list_json_opt
+ j = JSON.parse r
+ i = j.first
+ i.has_key?('licenses').should be_true
end
end
end\r
end\r
end
- describe 'å\8d\98ä½\93å\87ºå\8a\9bオプションに於いて' do
+ describe 'å\8d\98ä½\93å\8f\96å¾\97オプションに於いて' do
it 'includeキーを含んでいる' do
r = LicenseGroup.show_opt
r.has_key?(:include).should be_true
end
end
describe 'json単体出力オプションに於いて' do
- it 'includeキーを含んでいる' do
- r = LicenseGroup.show_json_opt
- r.has_key?(:include).should be_true
- end
- it '1つの項目を含んでいる' do
- r = LicenseGroup.show_json_opt[:include]
- r.should have(1).items
+ before do
+ @sp = FactoryGirl.create :system_picture
+ @lg = FactoryGirl.create :license_group
+ @license = FactoryGirl.create :license, :license_group_id => @lg.id, :system_picture_id => @sp.id
+ @user = FactoryGirl.create( :user_yas)
+ @author = @user.author
+ @artist = FactoryGirl.create :artist_yas, :author_id => @author.id
+ @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
+ @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
end
it 'ライセンスを含んでいる' do
- r = LicenseGroup.show_json_opt[:include]
- r.has_key?(:licenses).should be_true
+ r = LicenseGroup.show(@lg.id).to_json LicenseGroup.show_json_opt
+ j = JSON.parse r
+ i = j
+ i.has_key?('licenses').should be_true
end
end
l.should eq [@l3, @l, @l2]
end
end
- describe 'list関連テーブルプションに於いて' do
+ describe '一覧取得オプションに於いて' do
it 'includeキーを含んでいる' do
r = License.list_opt
r.has_key?(:include).should be_true
end
end
describe 'json一覧出力オプションに於いて' do
- it 'includeキーを含んでいる' do
- r = License.list_json_opt
- r.has_key?(:include).should be_true
- end
- it '1つの項目を含んでいる' do
- r = License.list_json_opt[:include]
- r.should have(1).items
+ before do
+ @sp = FactoryGirl.create :system_picture
+ @lg = FactoryGirl.create :license_group
+ @l = FactoryGirl.create :license, :license_group_id => @lg.id, :system_picture_id => @sp.id
end
it 'ライセンスグループを含んでいる' do
- r = License.list_json_opt[:include]
- r.has_key?(:license_group).should be_true
+ r = License.list.to_json License.list_json_opt
+ j = JSON.parse r
+ i = j.first
+ i.has_key?('license_group').should be_true
end
end
end
end
describe 'json単体出力オプションに於いて' do
- it 'includeキーを含んでいる' do
- r = License.show_json_opt
- r.has_key?(:include).should be_true
- end
- it '1つの項目を含んでいる' do
- r = License.show_json_opt[:include]
- r.should have(1).items
+ before do
+ @sp = FactoryGirl.create :system_picture
+ @lg = FactoryGirl.create :license_group
+ @l = FactoryGirl.create :license, :license_group_id => @lg.id, :system_picture_id => @sp.id
end
it 'ライセンスグループを含んでいる' do
- r = License.show_json_opt[:include]
- r.has_key?(:license_group).should be_true
+ r = License.show(@l.id).to_json License.show_json_opt
+ j = JSON.parse r
+ i = j
+ i.has_key?('license_group').should be_true
end
end
end
end
end
- describe 'list関連テーブルプションに於いて' do
+ describe '一覧取得オプションに於いて' do
it 'includeキーを含んでいる' do
r = OriginalPicture.list_opt
r.has_key?(:include).should be_true
end
end
describe 'json一覧出力オプションに於いて' do
- it 'includeキーを含んでいる' do
- r = OriginalPicture.list_json_opt
- r.has_key?(:include).should be_true
- end
- it '2つの項目を含んでいる' do
- r = OriginalPicture.list_json_opt[:include]
- r.should have(2).items
+ 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
+ @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
end
it '素材を含んでいる' do
- r = OriginalPicture.list_json_opt[:include]
- r.has_key?(:resource_picture).should be_true
+ r = OriginalPicture.mylist(@artist).to_json OriginalPicture.list_json_opt
+ j = JSON.parse r
+ i = j.first
+ i.has_key?('resource_picture').should be_true
end
it '実素材を含んでいる' do
- r = OriginalPicture.list_json_opt[:include]
- r.has_key?(:pictures).should be_true
+ r = OriginalPicture.mylist(@artist).to_json OriginalPicture.list_json_opt
+ j = JSON.parse r
+ i = j.first
+ i.has_key?('pictures').should be_true
end
end
end
end
end
- describe 'å\8d\98ä½\93å\87ºå\8a\9bオプションに於いて' do
+ describe 'å\8d\98ä½\93å\8f\96å¾\97オプションに於いて' do
it 'includeキーを含んでいる' do
r = OriginalPicture.show_opt
r.has_key?(:include).should be_true
end
end
describe 'json単体出力オプションに於いて' do
- it 'includeキーを含んでいる' do
- r = OriginalPicture.show_json_opt
- r.has_key?(:include).should be_true
- end
- it '2つの項目を含んでいる' do
- r = OriginalPicture.show_json_opt[:include]
- r.should have(2).items
+ 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
+ @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
end
it '素材を含んでいる' do
- r = OriginalPicture.show_json_opt[:include]
- r.has_key?(:resource_picture).should be_true
+ r = OriginalPicture.show(@op.id, @artist).to_json OriginalPicture.show_json_opt
+ j = JSON.parse r
+ i = j
+ i.has_key?('resource_picture').should be_true
end
it '実素材を含んでいる' do
- r = OriginalPicture.show_json_opt[:include]
- r.has_key?(:pictures).should be_true
+ r = OriginalPicture.show(@op.id, @artist).to_json OriginalPicture.show_json_opt
+ j = JSON.parse r
+ i = j
+ i.has_key?('pictures').should be_true
end
end
describe '作成・更新に於いて' do
end
end
end
- describe 'list関連テーブルプションに於いて' do
+ describe '一覧取得オプションに於いて' do
it 'includeキーを含んでいる' do
r = PanelColor.list_opt
r.has_key?(:include).should be_true
end
end
describe 'json一覧出力オプションに於いて' do
- it 'includeキーを含んでいる' do
- r = PanelColor.list_json_opt
- r.has_key?(:include).should be_true
- end
- it '1つの項目を含んでいる' do
- r = PanelColor.list_json_opt[:include]
- r.should have(1).items
+ 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
+ @comic = FactoryGirl.create :comic, :author_id => @author.id, :visible => 1
+ @panel = FactoryGirl.create :panel, :author_id => @author.id, :publish => 1
+ @pc = FactoryGirl.create :panel_color, :panel_id => @panel.id
+ @story = FactoryGirl.create :story, :author_id => @author.id, :comic_id => @comic.id, :panel_id => @panel.id
end
it 'コマを含んでいる' do
- r = PanelColor.list_json_opt[:include]
- r.has_key?(:panel).should be_true
+ r = PanelColor.list.to_json PanelColor.list_json_opt
+ j = JSON.parse r
+ i = j.first
+ i.has_key?('panel').should be_true
end
it 'コマは作家を含んでいる' do
- r = PanelColor.list_json_opt[:include]
- r[:panel].has_key?(:author).should be_true
+ r = PanelColor.list.to_json PanelColor.list_json_opt
+ j = JSON.parse r
+ i = j.first
+ s = i['panel']
+ s.has_key?('author').should be_true
end
end
end
end
end
- describe 'list関連テーブルプションに於いて' do
+ describe '一覧取得オプションに於いて' do
it 'includeキーを含んでいる' do
r = PanelPicture.list_opt
r.has_key?(:include).should be_true
end
end
describe 'json一覧出力オプションに於いて' do
- it 'includeキーを含んでいる' do
- r = PanelPicture.list_json_opt
- r.has_key?(:include).should be_true
- end
- it '2つの項目を含んでいる' do
- r = PanelPicture.list_json_opt[:include]
- r.should have(2).items
+ 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
+ @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
+ @pp = FactoryGirl.create :panel_picture, :panel_id => @panel.id, :picture_id => @p.id,
+ :width => @p.width, :height => @p.height
end
it 'コマを含んでいる' do
- r = PanelPicture.list_json_opt[:include]
- r.has_key?(:panel).should be_true
+ r = PanelPicture.list.to_json PanelPicture.list_json_opt
+ j = JSON.parse r
+ i = j.first
+ i.has_key?('panel').should be_true
end
it 'コマは作家を含んでいる' do
- r = PanelPicture.list_json_opt[:include]
- r[:panel].has_key?(:author).should be_true
+ r = PanelPicture.list.to_json PanelPicture.list_json_opt
+ j = JSON.parse r
+ i = j.first
+ s = i['panel']
+ s.has_key?('author').should be_true
end
it '実素材を含んでいる' do
- r = PanelPicture.list_json_opt[:include]
- r.has_key?(:picture).should be_true
+ r = PanelPicture.list.to_json PanelPicture.list_json_opt
+ j = JSON.parse r
+ i = j.first
+ i.has_key?('picture').should be_true
end
it '実素材は絵師を含んでいる' do
- r = PanelPicture.list_json_opt[:include]
- r[:picture].has_key?(:artist).should be_true
+ r = PanelPicture.list.to_json PanelPicture.list_json_opt
+ j = JSON.parse r
+ i = j.first
+ s = i['picture']
+ s.has_key?('artist').should be_true
end
it '実素材はライセンスを含んでいる' do
- r = PanelPicture.list_json_opt[:include]
- r[:picture].has_key?(:license).should be_true
+ r = PanelPicture.list.to_json PanelPicture.list_json_opt
+ j = JSON.parse r
+ i = j.first
+ s = i['picture']
+ s.has_key?('license').should be_true
end
end
end
end
end\r
- describe 'list関連テーブルプションに於いて' do\r
+ describe '一覧取得オプションに於いて' do\r
it 'includeキーを含んでいる' do\r
r = Panel.list_opt\r
r.has_key?(:include).should be_true\r
end\r
end\r
end\r
- describe '関連テーブルプションに於いて' do\r
+ describe '単体取得オプションに於いて' do\r
it 'includeキーを含んでいる' do\r
r = Panel.show_opt\r
r.has_key?(:include).should be_true\r
end
end
end\r
- describe 'ä¸\80覧å\87ºå\8a\9bオプションに於いて' do\r
+ describe 'ä¸\80覧å\8f\96å¾\97オプションに於いて' do\r
it 'includeキーを含んでいる' do
r = ResourcePicture.list_opt
r.has_key?(:include).should be_true
r.has_key?(:picture).should be_true
end
end\r
- describe 'json一覧出力オプションに於いて' do\r
- it 'includeキーを含んでいる' do
- r = ResourcePicture.list_json_opt
- r.has_key?(:include).should be_true
- end
- it '3つの項目を含んでいる' do
- r = ResourcePicture.list_json_opt[:include]
- r.should have(3).items
+ 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
+ @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
end
it 'ライセンスを含んでいる' do
- r = ResourcePicture.list_json_opt[:include]
- r.has_key?(:license).should be_true
+ r = ResourcePicture.list.to_json ResourcePicture.list_json_opt
+ j = JSON.parse r
+ i = j.first
+ i.has_key?('license').should be_true
end
it '絵師を含んでいる' do
- r = ResourcePicture.list_json_opt[:include]
- r.has_key?(:artist).should be_true
+ r = ResourcePicture.list.to_json ResourcePicture.list_json_opt
+ j = JSON.parse r
+ i = j.first
+ i.has_key?('artist').should be_true
end
it '実素材を含んでいる' do
- r = ResourcePicture.list_json_opt[:include]
- r.has_key?(:picture).should be_true
+ r = ResourcePicture.list.to_json ResourcePicture.list_json_opt
+ j = JSON.parse r
+ i = j.first
+ i.has_key?('picture').should be_true
end
- end\r
+ end
\r
describe '単体取得に於いて' do\r
before do\r
end\r
end\r
end\r
- describe 'å\8d\98ä½\93å\87ºå\8a\9bオプションに於いて' do\r
+ describe 'å\8d\98ä½\93å\8f\96å¾\97オプションに於いて' do\r
it 'includeキーを含んでいる' do
r = ResourcePicture.show_opt
r.has_key?(:include).should be_true
end
end\r
describe 'json単体出力オプションに於いて' do\r
- it 'includeキーを含んでいる' do
- r = ResourcePicture.show_json_opt
- r.has_key?(:include).should be_true
- end
- it '3つの項目を含んでいる' do
- r = ResourcePicture.show_json_opt[:include]
- r.should have(3).items
+ 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
+ @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
end
it 'ライセンスを含んでいる' do
- r = ResourcePicture.show_json_opt[:include]
- r.has_key?(:license).should be_true
+ r = ResourcePicture.show(@rp.id, @author).to_json ResourcePicture.show_json_opt
+ j = JSON.parse r
+ i = j
+ i.has_key?('license').should be_true
end
it '絵師を含んでいる' do
- r = ResourcePicture.show_json_opt[:include]
- r.has_key?(:artist).should be_true
+ r = ResourcePicture.show(@rp.id, @author).to_json ResourcePicture.show_json_opt
+ j = JSON.parse r
+ i = j
+ i.has_key?('artist').should be_true
end
it '実素材を含んでいる' do
- r = ResourcePicture.show_json_opt[:include]
- r.has_key?(:picture).should be_true
+ r = ResourcePicture.show(@rp.id, @author).to_json ResourcePicture.show_json_opt
+ j = JSON.parse r
+ i = j
+ i.has_key?('picture').should be_true
end
end\r
\r