X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=spec%2Ffactories.rb;h=5c940d96789c932d830d19ab40ef252b82e82a34;hb=339d45c101d93bf611299e3c90f3883f28937c2b;hp=779e4eded59f98f387962290c8871a9b1641e8f9;hpb=d4b405468eaa585e86f904cb6739076eb9702df8;p=pettanr%2Fpettanr.git diff --git a/spec/factories.rb b/spec/factories.rb index 779e4ede..5c940d96 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -1,210 +1,246 @@ -Factory.define :admin, :class => Admin do |admin| - admin.sequence(:email) { |n| "admin#{n}@gmail.com"} - admin.password "admin0100" - admin.password_confirmation "admin0100" - admin.approve 1 +# -*- encoding: utf-8 -*- +#テストデータ +FactoryGirl.define do + factory :admin, :class => Admin do |admin| + admin.sequence(:email) { |n| "admin#{n}@gmail.com"} + admin.password "admin0100" + admin.password_confirmation "admin0100" + admin.approve 1 + end + + factory :user_yas, :class => User do |user| + user.sequence(:email) { |n| "hoge#{n}@gmail.com"} + user.password "user0100" + user.password_confirmation "user0100" + # user.author FactoryGirl.create(:author_yas) + end + + factory :demand_user, :class => DemandUser do |demand_user| + demand_user.sequence(:email) { |n| "hoge#{n}@gmail.com"} + demand_user.password "user0100" + demand_user.password_confirmation "user0100" + # user.author FactoryGirl.create(:author_yas) + end + + factory :author, :class => Author do |author| + author.name 'test' + author.sequence(:user_id) { |n| n} + end + + factory :author_yas, :class => Author do |author| + author.name 'yassan' + author.sequence(:user_id) { |n| n} + # author.association :user_yas + # author.artist FactoryGirl.create(:artist_yas) + end + + factory :artist, :class => Artist do |artist| + artist.sequence(:email) { |n| "hoge#{n}@gmail.com"} + artist.name 'art' + # artist.association :author_yas + end + + factory :artist_yas, :class => Artist do |artist| + artist.sequence(:email) { |n| "hoge#{n}@gmail.com"} + artist.name 'yas' + # artist.association :author_yas + end + + factory :license_group, :class => LicenseGroup do |license_group| + license_group.name 'pettan_public_01' + license_group.classname 'PettanPublicLicense' + license_group.caption 'pettan public 0.1' + license_group.url 'http://test.lc/' + end + + factory :license, :class => License do |license| + license.license_group_id 1 + license.name 'peta2.5' + license.caption 'flag' + license.url 'http://test.lc/' + license.system_picture_id 1 + end + + factory :color, :class => Color do |color| + color.name 'black' + color.code 0 + color.t 0 + end + + factory :comic, :class => Comic do |comic| + comic.title "comic" + comic.visible 1 + end + + factory :original_picture, :class => OriginalPicture do |op| + op.ext 'png' + op.width 222 + op.height 111 + op.filesize 100000 + op.artist_id 1 + op.md5 'op8f6bcd4621d373cade4e832627b4f6' + end + + factory :oplg, :class => OriginalPictureLicenseGroup do |oplg| + oplg.original_picture_id 1 + oplg.license_group_id 1 + end + + factory :resource_picture, :class => ResourcePicture do |rp| + rp.ext 'png' + rp.width 222 + rp.height 111 + rp.filesize 100000 + rp.md5 'rp8f6bcd4621d373cade4e832627b4f6' + rp.artist_id 1 + rp.license_id 1 + rp.classname 'StandardLicense' + rp.original_picture_id 1 + end + + factory :picture, :class => Picture do |p| + p.original_picture_id 1 + p.revision 1 + p.ext 'png' + p.width 222 + p.height 111 + p.filesize 100000 + p.md5 'ap8f6bcd4621d373cade4e832627b4f6' + p.artist_id 1 + p.license_id 1 + p.artist_name 'no name' + p.classname 'StandardLicense' + p.credit '' + p.settings '' + end + + factory :system_picture, :class => SystemPicture do |sp| + sp.ext 'png' + sp.width 222 + sp.height 111 + sp.filesize 100000 + sp.md5 '098f6bcd4621d373cade4e832627b4f6' + end + + factory :speech_balloon_template, :class => SpeechBalloonTemplate do |sbt| + sbt.name 'Plain@pettanr.com' + sbt.classname 'Plain' + sbt.caption 'normal fuki' + sbt.t 0 + sbt.settings '{}' + end + + factory :speech_balloon, :class => SpeechBalloon do |sb| + sb.panel_id 1 + sb.speech_balloon_template_id 1 + sb.classname 'Plain' + sb.z 1 + sb.t 0 + sb.settings '{}' + end + + factory :balloon, :class => Balloon do |balloon| + balloon.speech_balloon_id 1 + balloon.system_picture_id 1 + balloon.x 100 + balloon.y 200 + balloon.width 222 + balloon.height 333 + balloon.caption 'test pict' + balloon.settings nil + end + + factory :speech, :class => Speech do |speech| + speech.speech_balloon_id 1 + speech.content 'test' + speech.x 10 + speech.y 100 + speech.width 200 + speech.height 190 + speech.settings nil + end + + factory :panel_picture, :class => PanelPicture do |pp| + pp.panel_id 1 + pp.picture_id 1 + pp.link '' + pp.x 111 + pp.y 200 + pp.z 1 + pp.t 0 + pp.width 100 + pp.height 300 + end + + factory :panel_color, :class => PanelColor do |pc| + pc.panel_id 1 + pc.z 1 + pc.code 1 + end + + factory :ground_color, :class => GroundColor do |gc| + gc.panel_id 1 + gc.color_id 1 + gc.z 1 + end + + factory :ground_picture, :class => GroundPicture do |gp| + gp.panel_id 1 + gp.picture_id 1 + gp.z 1 + end + + factory :panel, :class => Panel do |panel| + panel.border 1 + panel.x nil + panel.y nil + panel.z nil + panel.width 100 + panel.height 300 + panel.publish 1 + panel.author_id 1 + end + + factory :story, :class => Story do |story| + story.comic_id 1 + story.panel_id 1 + story.author_id 1 + story.t 0 + end + + factory :provider, :class => Provider do |provider| + provider.name 'admin@penguinkingdom.com' + provider.caption 'ペンギン王国' + provider.url 'http://localhost:3000/' + provider.description 'ペンギン王国はペンギン素材を豊富に用意したペンギンマニアのサイトです。' + provider.demander_url 'http://localhost:3000/demanders' + provider.provider_status_id 1 + end + + factory :provider_status, :class => ProviderStatus do |provider_status| + provider_status.token nil + provider_status.receive_hour1 nil + provider_status.receive_hour2 nil + provider_status.received_at nil + provider_status.stopped_at nil + end + + factory :demander, :class => Demander do |demander| + demander.demand_user_id 1 + demander.name 'admin@penguinkingdom.com' + demander.caption 'ペンギン王国' + demander.url 'http://localhost:3000/' + demander.description 'ペンギン王国はペンギン素材を豊富に用意したペンギンマニアのサイトです。' + demander.demander_url 'http://localhost:3000/demanders' + demander.demander_status_id 1 + end + + factory :demander_status, :class => DemanderStatus do |demander_status| + demander_status.requested_at nil + demander_status.rejected_at nil + demander_status.approved_at nil + demander_status.token nil + demander_status.receive_hour1 nil + demander_status.receive_hour2 nil + end end - -Factory.define :user_yas, :class => User do |user| - user.sequence(:email) { |n| "hoge#{n}@gmail.com"} - user.password "user0100" - user.password_confirmation "user0100" -# user.author Factory(:author_yas) -end - -Factory.define :author, :class => Author do |author| - author.name nil - author.sequence(:user_id) { |n| n} -end - -Factory.define :author_yas, :class => Author do |author| - author.name 'yassan' - author.sequence(:user_id) { |n| n} -# author.association :user_yas -# author.artist Factory(:artist_yas) -end - -Factory.define :artist, :class => Artist do |artist| - artist.sequence(:email) { |n| "hoge#{n}@gmail.com"} - artist.name 'art' -# artist.association :author_yas -end - -Factory.define :artist_yas, :class => Artist do |artist| - artist.sequence(:email) { |n| "hoge#{n}@gmail.com"} - artist.name 'yas' -# artist.association :author_yas -end - -Factory.define :license_group, :class => LicenseGroup do |license_group| - license_group.name 'pettan_public_01' - license_group.classname 'PettanPublicLicense' - license_group.caption 'pettan public 0.1' - license_group.url 'http://test.lc/' -end - -Factory.define :license, :class => License do |license| - license.license_group_id 1 - license.name 'peta2.5' - license.caption 'flag' - license.url 'http://test.lc/' - license.system_picture_id 1 -end - -Factory.define :common_license, :class => CommonLicense do |license| - license.license_id 0 - license.name 'peta2.1' - license.url 'http://test.lc/' - license.cc_by 0 - license.cc_sa 0 - license.cc_nd 0 - license.cc_nc 0 - license.no_resize 0 - license.no_flip 0 - license.no_convert 0 - license.keep_aspect_ratio 0 -end - -Factory.define :original_license, :class => OriginalLicense do |license| - license.license_id 0 - license.name 'peta2.1' - license.url 'http://test.olc/' - license.cc_by 0 - license.cc_sa 0 - license.cc_nd 0 - license.cc_nc 0 - license.no_resize 0 - license.no_flip 0 - license.no_convert 0 - license.keep_aspect_ratio 0 -end - -Factory.define :comic, :class => Comic do |comic| - comic.title "comic" - comic.width 100 - comic.height 10 - comic.visible 3 - comic.editable 3 -end - -Factory.define :normal_comic, :class => Comic do |comic| - comic.title "normal_comic" - comic.width 100 - comic.height 10 - comic.visible 3 - comic.editable 0 -end - -Factory.define :visible_comic, :class => Comic do |comic| - comic.title "visible_comic" - comic.width 100 - comic.height 10 - comic.visible 3 - comic.editable 0 -end - -Factory.define :editable_comic, :class => Comic do |comic| - comic.title "editable_comic" - comic.width 100 - comic.height 10 - comic.visible 3 - comic.editable 3 -end - -Factory.define :hidden_comic, :class => Comic do |comic| - comic.title "hidden_comic" - comic.width 100 - comic.height 10 - comic.visible 0 - comic.editable 0 -end - -Factory.define :original_picture, :class => OriginalPicture do |op| - op.ext 'png' - op.width 222 - op.height 111 - op.filesize 100000 - op.artist_id 1 - op.license_id 1 -end - -Factory.define :resource_picture, :class => ResourcePicture do |rp| - rp.ext 'png' - rp.width 222 - rp.height 111 - rp.filesize 100000 - rp.artist_id 1 - rp.license_id 1 - rp.original_picture_id 1 -end - -Factory.define :system_picture, :class => SystemPicture do |sp| - sp.ext 'png' - sp.width 222 - sp.height 111 - sp.filesize 100000 - sp.md5 '098f6bcd4621d373cade4e832627b4f6' -end - -Factory.define :speech_balloon_template, :class => SpeechBalloonTemplate do |sbt| - sbt.name 'Plain@pettanr.com' - sbt.classname 'Plain' - sbt.caption 'normal fuki' - sbt.t 0 - sbt.settings '{}' -end - -Factory.define :speech_balloon, :class => SpeechBalloon do |sb| - sb.panel_id 1 - sb.speech_balloon_template_id 1 - sb.classname 'Plain' - sb.z 1 - sb.t 0 - sb.settings '{}' -end - -Factory.define :balloon, :class => Balloon do |balloon| - balloon.speech_balloon_id 1 - balloon.system_picture_id 1 - balloon.x 100 - balloon.y 200 - balloon.width 222 - balloon.height 333 - balloon.caption 'test pict' - balloon.settings nil -end - -Factory.define :speech, :class => Speech do |speech| - speech.speech_balloon_id 1 - speech.content 'test' - speech.x 10 - speech.y 100 - speech.width 200 - speech.height 190 - speech.settings nil -end - -Factory.define :panel_picture, :class => PanelPicture do |pp| - pp.panel_id 1 - pp.resource_picture_id 1 - pp.link '' - pp.x 111 - pp.y 200 - pp.z 1 - pp.t 0 - pp.width 100 - pp.height 300 -end - -Factory.define :panel, :class => Panel do |panel| - panel.comic_id 1 - panel.border 1 - panel.x nil - panel.y nil - panel.z nil - panel.t 0 - panel.width 100 - panel.height 300 - panel.author_id 1 -end -