1 # -*- encoding: utf-8 -*-
6 include ManifestsMacros
11 describe 'ペタナイズに於いて' do
12 it '絵師が投稿するコンテンツである' do
13 expect(@model.ancestors.include?(Peta::Content)).to eq true
16 expect(@model.my_peta.parent_model_name).to be_blank
18 describe 'ブーストに於いて' do
20 @boosts = @model.my_peta.boost
21 @boosts_names = ['license_group', 'license', 'credit_picture']
23 it 'これらのブーストが定義されている' do
24 set_boosts? @boosts, @boosts_names
26 describe 'ライセンスグループに於いて' do
28 @mani = @boosts['license_group']
31 expect(@mani.level).to eq 'post'
32 expect(@mani.template_name).to eq 'license_group'
33 expect(@mani.column_name_for_template_module).to eq 'license_group_module_name'
34 expect(@mani.settings_column_name).to eq 'license_group_settings'
35 expect(@mani.foreign_key).to eq 'license_group_id'
38 expect(@mani.item_name_for_extend_model).to eq 'license'
39 expect(@mani.setter_method_name).to eq 'license_extend='
40 expect(@mani.getter_method_name).to eq 'license_extend'
41 expect(@mani.extend_model_class_name).to eq 'License'
42 expect(@mani.extend_module_name).to eq 'LicenseModule'
45 describe 'ライセンスに於いて' do
47 @mani = @boosts['license']
50 expect(@mani.level).to eq 'read'
51 expect(@mani.template_name).to eq 'license_group'
52 expect(@mani.column_name_for_template_module).to eq 'license_group_module_name'
53 expect(@mani.settings_column_name).to eq 'license_settings'
54 expect(@mani.foreign_key).to eq 'license_group_id'
57 expect(@mani.item_name_for_extend_model).to eq 'attribute'
58 expect(@mani.setter_method_name).to eq 'attribute_extend='
59 expect(@mani.getter_method_name).to eq 'attribute_extend'
60 expect(@mani.extend_model_class_name).to eq 'Attribute'
61 expect(@mani.extend_module_name).to eq 'AttributeModule'
64 describe 'クレジットに於いて' do
66 @mani = @boosts['credit_picture']
69 expect(@mani.level).to eq 'read'
70 expect(@mani.template_name).to eq 'license_group'
71 expect(@mani.column_name_for_template_module).to eq 'license_group_module_name'
72 expect(@mani.settings_column_name).to eq 'credit_picture_settings'
73 expect(@mani.foreign_key).to eq 'license_group_id'
76 expect(@mani.item_name_for_extend_model).to eq 'credit_picture'
77 expect(@mani.setter_method_name).to eq 'credit_picture_extend='
78 expect(@mani.getter_method_name).to eq 'credit_picture_extend'
79 expect(@mani.extend_model_class_name).to eq 'CreditPicture'
80 expect(@mani.extend_module_name).to eq 'CreditPictureModule'
87 describe 'コントローラに於いて' do
89 @controller = @model.my_controller
91 it '実素材のためのコントローラである' do
92 expect(@model.item_name).to eq 'picture'
94 describe 'actionに於いて' do
96 @actions = @controller.actions
97 @actions_names = ['index', 'by_artist', 'show',
98 'count', 'count_by_artist']
100 it 'これらのアクションが定義されている' do
101 set_actions? @actions, @actions_names
103 describe 'baseに於いて' do
105 describe 'indexに於いて' do
107 @action = @actions['index']
109 it 'listタイプのアクションである' do
110 expect(@action.type).to eq 'list'
112 it 'マニフェストから設定を取り出している' do
113 # 実素材の公開リストを返すように定義している
114 set_list_action? @action, 'picture', 'public'
117 describe 'by_artistに於いて' do
119 @action = @actions['by_artist']
121 it 'listタイプのアクションである' do
122 expect(@action.type).to eq 'list'
124 it 'マニフェストから設定を取り出している' do
125 # 実素材の絵師フィルタリストを返すように定義している
126 set_list_action? @action, 'picture', 'by_artist'
129 describe 'countに於いて' do
131 @action = @actions['count']
133 it 'countタイプのアクションである' do
134 expect(@action.type).to eq 'count'
136 it 'マニフェストから設定を取り出している' do
137 #実素材の公開リストのカウントを返すように定義している
138 set_list_action? @action, 'picture', 'public'
141 describe 'showに於いて' do
143 @action = @actions['show']
145 it 'showタイプのアクションである' do
146 expect(@action.type).to eq 'show'
149 describe 'count_by_artistに於いて' do
151 @action = @actions['count_by_artist']
153 it 'countタイプのアクションである' do
154 expect(@action.type).to eq 'count'
156 it 'マニフェストから設定を取り出している' do
157 # 実素材の絵師フィルタリストのカウントを返すように定義している
158 set_list_action? @action, 'picture', 'by_artist'
165 describe 'モデルに於いて' do
167 @my_manifest = @model.my_manifest
169 it 'サポート機能が動作している' do
170 expect(@my_manifest.model_name).to eq 'picture'
171 expect(@my_manifest.classify).to eq @model
172 expect(@my_manifest.table_name).to eq 'pictures'
175 describe 'associationsに於いて' do
176 describe 'belongs_toに於いて' do
178 @belongs_to = @my_manifest.associations.belongs_to
179 @names = ['artist', 'license', 'system_picture']
181 it 'これらのモデルに所属している' do
182 set_associations? @belongs_to, @names
184 describe 'artistに於いて' do
186 @mani = @belongs_to['artist']
188 it 'マニフェストから設定を取り出している' do
189 # モデル名と外部キーが定義あるいはデフォルト値補充されている
190 expect(@mani.model_name).to eq 'artist'
191 expect(@mani.id_column).to eq 'artist_id'
193 it 'サポート機能が動作している' do
195 expect(@mani.model).to eq Artist
198 describe 'licenseに於いて' do
200 @mani = @belongs_to['license']
202 it 'マニフェストから設定を取り出している' do
203 # モデル名と外部キーが定義あるいはデフォルト値補充されている
204 expect(@mani.model_name).to eq 'license'
205 expect(@mani.id_column).to eq 'license_id'
207 it 'サポート機能が動作している' do
209 expect(@mani.model).to eq License
212 describe 'system_pictureに於いて' do
214 @mani = @belongs_to['system_picture']
216 it 'マニフェストから設定を取り出している' do
217 # モデル名と外部キーが定義あるいはデフォルト値補充されている
218 expect(@mani.model_name).to eq 'system_picture'
219 expect(@mani.id_column).to eq 'system_picture_id'
221 it 'サポート機能が動作している' do
223 expect(@mani.model).to eq SystemPicture
227 describe 'has_manyに於いて' do
229 @has_many = @model.my_manifest.associations.has_many
232 it 'これらのモデルを所持している' do
233 set_associations? @has_many, @names
238 describe 'attributesに於いて' do
240 @attributes = @model.my_manifest.attributes
242 it 'これらのカラムを定義している' do
243 set_attributes? @attributes,
244 ['id', 'original_picture_id', 'revision', 'ext',
245 'width', 'height', 'filesize', 'artist_id', 'license_id', 'md5', 'system_picture_id',
246 'license_group_settings', 'credit_picture_settings',
247 'license_settings', 'license_group_module_name',
248 'created_at', 'updated_at']
250 describe 'original_picture_idに於いて' do
252 @attribute = @attributes['original_picture_id']
255 expect(@attribute.type).to eq 'number'
258 describe 'revisionに於いて' do
260 @attribute = @attributes['revision']
263 expect(@attribute.type).to eq 'number'
266 describe 'extに於いて' do
268 @attribute = @attributes['ext']
271 expect(@attribute.type).to eq 'text'
274 describe 'widthに於いて' do
276 @attribute = @attributes['width']
279 expect(@attribute.type).to eq 'number'
282 describe 'heightに於いて' do
284 @attribute = @attributes['height']
287 expect(@attribute.type).to eq 'number'
290 describe 'filesizeに於いて' do
292 @attribute = @attributes['filesize']
295 expect(@attribute.type).to eq 'number'
298 describe 'artist_idに於いて' do
300 @attribute = @attributes['artist_id']
303 expect(@attribute.type).to eq 'number'
306 describe 'license_idに於いて' do
308 @attribute = @attributes['license_id']
311 expect(@attribute.type).to eq 'number'
314 describe 'md5に於いて' do
316 @attribute = @attributes['md5']
319 expect(@attribute.type).to eq 'text'
322 describe 'system_picture_idに於いて' do
324 @attribute = @attributes['system_picture_id']
327 expect(@attribute.type).to eq 'number'
330 describe 'license_group_settingsに於いて' do
332 @attribute = @attributes['license_group_settings']
335 expect(@attribute.type).to eq 'text'
338 describe 'credit_picture_settingsに於いて' do
340 @attribute = @attributes['credit_picture_settings']
343 expect(@attribute.type).to eq 'text'
346 describe 'license_settingsに於いて' do
348 @attribute = @attributes['license_settings']
351 expect(@attribute.type).to eq 'text'
354 describe 'license_group_module_nameに於いて' do
356 @attribute = @attributes['license_group_module_name']
359 expect(@attribute.type).to eq 'text'