OSDN Git Service

t#29194
[pettanr/pettanr.git] / spec / factories.rb
1 FactoryGirl.define do
2   factory :admin, :class => Admin do |admin|
3     admin.sequence(:email) { |n| "admin#{n}@gmail.com"}
4     admin.password "admin0100"
5     admin.password_confirmation "admin0100"
6     admin.approve 1
7   end
8
9   factory :user_yas, :class => User do |user|
10     user.sequence(:email) { |n| "hoge#{n}@gmail.com"}
11     user.password "user0100"
12     user.password_confirmation "user0100"
13   #  user.author FactoryGirl.create(:author_yas)
14   end
15
16   factory :author, :class => Author do |author|
17     author.name nil
18     author.sequence(:user_id) { |n| n}
19   end
20
21   factory :author_yas, :class => Author do |author|
22     author.name 'yassan'
23     author.sequence(:user_id) { |n| n}
24   #  author.association :user_yas
25   #  author.artist FactoryGirl.create(:artist_yas)
26   end
27
28   factory :artist, :class => Artist do |artist|
29     artist.sequence(:email) { |n| "hoge#{n}@gmail.com"}
30     artist.name 'art'
31   #  artist.association :author_yas
32   end
33
34   factory :artist_yas, :class => Artist do |artist|
35     artist.sequence(:email) { |n| "hoge#{n}@gmail.com"}
36     artist.name 'yas'
37   #  artist.association :author_yas
38   end
39
40   factory :license_group, :class => LicenseGroup do |license_group|
41     license_group.name 'pettan_public_01'
42     license_group.classname 'PettanPublicLicense'
43     license_group.caption 'pettan public 0.1'
44     license_group.url 'http://test.lc/'
45   end
46
47   factory :license, :class => License do |license|
48     license.license_group_id 1
49     license.name 'peta2.5'
50     license.caption 'flag'
51     license.url 'http://test.lc/'
52     license.system_picture_id 1
53   end
54
55   factory :comic, :class => Comic do |comic|
56     comic.title "comic"
57     comic.width 100
58     comic.height 10
59     comic.visible 3
60   end
61
62   factory :original_picture, :class => OriginalPicture do |op|
63     op.ext 'png'
64     op.width 222
65     op.height 111
66     op.filesize 100000
67     op.artist_id 1
68   end
69
70   factory :oplg, :class => OriginalPictureLicenseGroup do |oplg|
71     oplg.original_picture_id 1
72     oplg.license_group_id 1
73   end
74
75   factory :resource_picture, :class => ResourcePicture do |rp|
76     rp.ext 'png'
77     rp.width 222
78     rp.height 111
79     rp.filesize 100000
80     rp.artist_id 1
81     rp.license_id 1
82     rp.classname 'StandardLicense'
83     rp.original_picture_id 1
84   end
85
86   factory :picture, :class => Picture do |p|
87     p.original_picture_id 1
88     p.revision 1
89     p.ext 'png'
90     p.width 222
91     p.height 111
92     p.filesize 100000
93     p.artist_id 1
94     p.license_id 1
95     p.artist_name 'no name'
96     p.classname 'StandardLicense'
97     p.credit ''
98     p.settings ''
99   end
100
101   factory :system_picture, :class => SystemPicture do |sp|
102     sp.ext 'png'
103     sp.width 222
104     sp.height 111
105     sp.filesize 100000
106     sp.md5 '098f6bcd4621d373cade4e832627b4f6'
107   end
108
109   factory :speech_balloon_template, :class => SpeechBalloonTemplate do |sbt|
110     sbt.name 'Plain@pettanr.com'
111     sbt.classname 'Plain'
112     sbt.caption 'normal fuki'
113     sbt.t 0
114     sbt.settings '{}'
115   end
116
117   factory :speech_balloon, :class => SpeechBalloon do |sb|
118     sb.panel_id 1
119     sb.speech_balloon_template_id 1
120     sb.classname 'Plain'
121     sb.z 1
122     sb.t 0
123     sb.settings '{}'
124   end
125
126   factory :balloon, :class => Balloon do |balloon|
127     balloon.speech_balloon_id 1
128     balloon.system_picture_id 1 
129     balloon.x 100
130     balloon.y 200
131     balloon.width 222 
132     balloon.height 333 
133     balloon.caption 'test pict'
134     balloon.settings nil
135   end
136
137   factory :speech, :class => Speech do |speech|
138     speech.speech_balloon_id 1
139     speech.content 'test'
140     speech.x 10
141     speech.y 100
142     speech.width 200
143     speech.height 190
144     speech.settings nil
145   end
146
147   factory :panel_picture, :class => PanelPicture do |pp|
148     pp.panel_id 1
149     pp.picture_id 1
150     pp.link ''
151     pp.x 111
152     pp.y 200
153     pp.z 1
154     pp.t 0
155     pp.width 100
156     pp.height 300
157   end
158
159   factory :panel, :class => Panel do |panel|
160     panel.border 1
161     panel.x nil
162     panel.y nil
163     panel.z nil
164     panel.width 100
165     panel.height 300
166     panel.publish 1
167     panel.author_id 1
168   end
169
170   factory :story, :class => Story do |story|
171     story.comic_id 1
172     story.panel_id 1
173     story.author_id 1
174     story.t 0
175   end
176 end