OSDN Git Service

Merge branch 'v04' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v04
[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 :common_license, :class => CommonLicense do |license|
56     license.license_id 0
57     license.name 'peta2.1'
58     license.url 'http://test.lc/'
59     license.cc_by 0
60     license.cc_sa 0
61     license.cc_nd 0
62     license.cc_nc 0
63     license.no_resize 0
64     license.no_flip 0
65     license.no_convert 0
66     license.keep_aspect_ratio 0
67   end
68
69   factory :original_license, :class => OriginalLicense do |license|
70     license.license_id 0
71     license.name 'peta2.1'
72     license.url 'http://test.olc/'
73     license.cc_by 0
74     license.cc_sa 0
75     license.cc_nd 0
76     license.cc_nc 0
77     license.no_resize 0
78     license.no_flip 0
79     license.no_convert 0
80     license.keep_aspect_ratio 0
81   end
82
83   factory :comic, :class => Comic do |comic|
84     comic.title "comic"
85     comic.width 100
86     comic.height 10
87     comic.visible 3
88   end
89
90   factory :original_picture, :class => OriginalPicture do |op|
91     op.ext 'png'
92     op.width 222
93     op.height 111
94     op.filesize 100000
95     op.artist_id 1
96   end
97
98   factory :oplg, :class => OriginalPictureLicenseGroup do |oplg|
99     oplg.original_picture_id 1
100     oplg.license_group_id 1
101   end
102
103   factory :resource_picture, :class => ResourcePicture do |rp|
104     rp.ext 'png'
105     rp.width 222
106     rp.height 111
107     rp.filesize 100000
108     rp.artist_id 1
109     rp.license_id 1
110     rp.classname 'StandardLicense'
111     rp.original_picture_id 1
112   end
113
114   factory :picture, :class => Picture do |p|
115     p.original_picture_id 1
116     p.revision 1
117     p.ext 'png'
118     p.width 222
119     p.height 111
120     p.filesize 100000
121     p.artist_id 1
122     p.license_id 1
123     p.artist_name 'no name'
124     p.classname 'StandardLicense'
125     p.credit ''
126     p.settings ''
127   end
128
129   factory :system_picture, :class => SystemPicture do |sp|
130     sp.ext 'png'
131     sp.width 222
132     sp.height 111
133     sp.filesize 100000
134     sp.md5 '098f6bcd4621d373cade4e832627b4f6'
135   end
136
137   factory :speech_balloon_template, :class => SpeechBalloonTemplate do |sbt|
138     sbt.name 'Plain@pettanr.com'
139     sbt.classname 'Plain'
140     sbt.caption 'normal fuki'
141     sbt.t 0
142     sbt.settings '{}'
143   end
144
145   factory :speech_balloon, :class => SpeechBalloon do |sb|
146     sb.panel_id 1
147     sb.speech_balloon_template_id 1
148     sb.classname 'Plain'
149     sb.z 1
150     sb.t 0
151     sb.settings '{}'
152   end
153
154   factory :balloon, :class => Balloon do |balloon|
155     balloon.speech_balloon_id 1
156     balloon.system_picture_id 1 
157     balloon.x 100
158     balloon.y 200
159     balloon.width 222 
160     balloon.height 333 
161     balloon.caption 'test pict'
162     balloon.settings nil
163   end
164
165   factory :speech, :class => Speech do |speech|
166     speech.speech_balloon_id 1
167     speech.content 'test'
168     speech.x 10
169     speech.y 100
170     speech.width 200
171     speech.height 190
172     speech.settings nil
173   end
174
175   factory :panel_picture, :class => PanelPicture do |pp|
176     pp.panel_id 1
177     pp.picture_id 1
178     pp.link ''
179     pp.x 111
180     pp.y 200
181     pp.z 1
182     pp.t 0
183     pp.width 100
184     pp.height 300
185   end
186
187   factory :panel, :class => Panel do |panel|
188     panel.border 1
189     panel.x nil
190     panel.y nil
191     panel.z nil
192     panel.width 100
193     panel.height 300
194     panel.publish 1
195     panel.author_id 1
196   end
197
198   factory :story, :class => Story do |story|
199     story.comic_id 1
200     story.panel_id 1
201     story.author_id 1
202     story.t 0
203   end
204 end