1 # -*- encoding: utf-8 -*-
4 describe PanelPicture do
5 include LocalManifestsMacros
10 describe 'ファイラーに於いて' do
12 @my_local_manifest = LocalManifest.manifest.filers[@model.item_name]
15 expect(@my_local_manifest.item_class).to eq @model
16 expect(@my_local_manifest.item_name).to eq @model.item_name
17 expect(@my_local_manifest.filer_name).to eq @model.item_name
19 describe 'symbolに於いて' do
21 @symbol = @my_local_manifest.symbol
23 it 'defaultタイプのsymbolである' do
24 expect(@symbol.type).to eq 'default'
27 expect(@symbol.visible?).to be true
29 describe 'faceに於いて' do
33 it 'imageタイプのfaceである' do
34 expect(@face.type).to eq 'image'
36 it 'マニフェストから設定を取り出している' do
37 expect(@face.url).to eq '/images/scroll.gif'
40 describe 'linkに於いて' do
44 it 'actionタイプのlinkである' do
45 expect(@link.type).to eq 'action'
47 it 'マニフェストから設定を取り出している' do
48 expect(@link.action_name).to eq 'show'
51 expect(@link.action_path).to eq '/scrolls/'
55 describe 'captionに於いて' do
57 @caption = @my_local_manifest.caption
59 it 'defaultタイプのsymbolである' do
60 expect(@caption.type).to eq 'default'
63 expect(@caption.visible?).to be true
65 describe 'faceに於いて' do
69 it 'columnタイプのfaceである' do
70 expect(@face.type).to eq 'column'
72 it 'マニフェストから設定を取り出している' do
73 expect(@face.column_name).to eq 'title'
76 describe 'linkに於いて' do
80 it 'actionタイプのlinkである' do
81 expect(@link.type).to eq 'action'
83 it 'マニフェストから設定を取り出している' do
84 expect(@link.action_name).to eq 'play'
87 expect(@link.action_path).to eq '/scrolls/play/'
91 describe 'summaryに於いて' do
93 @summary = @my_local_manifest.summary
95 it 'templateタイプのsymbolである' do
96 expect(@summary.type).to eq 'template'
98 it 'マニフェストから設定を取り出している' do
99 expect(@summary.template_name).to eq 'summary'
102 describe 'iconに於いて' do
104 @icon = @my_local_manifest.icon
106 it 'defaultタイプのsymbolである' do
107 expect(@icon.type).to eq 'default'
109 it 'サポート機能が動作している' do
110 expect(@icon.visible?).to be true
113 describe 'dateに於いて' do
115 @date = @my_local_manifest.date
117 it 'defaultタイプのsymbolである' do
118 expect(@date.type).to eq 'default'
120 it 'サポート機能が動作している' do
121 expect(@date.visible?).to be true
124 describe 'editに於いて' do
126 @edit = @my_local_manifest.edit
128 it 'defaultタイプのsymbolである' do
129 expect(@edit.type).to eq 'default'
131 it 'サポート機能が動作している' do
132 expect(@edit.visible?).to be true
137 describe 'プロファイラーに於いて' do
139 @my_local_manifest = LocalManifest.manifest.profilers[@model.item_name]
141 it 'マニフェストから設定を取り出している' do
142 expect(@my_local_manifest.item_name).to eq @model.item_name
144 describe 'columnsに於いて' do
146 @columns = @my_local_manifest.columns
147 @names = ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at']
149 it 'これらのカラムが定義されている' do
150 set_columns? @columns, @names
152 describe 'titleに於いて' do
154 @column = @columns['title']
156 it 'defaultタイプのcolumnである' do
157 expect(@column.type).to eq 'default'
159 it 'マニフェストから設定を取り出している' do
160 expect(@column.item_name).to eq 'scroll'
163 describe 'descriptionに於いて' do
165 @column = @columns['description']
167 it 'defaultタイプのcolumnである' do
168 expect(@column.type).to eq 'default'
170 it 'マニフェストから設定を取り出している' do
171 expect(@column.item_name).to eq 'scroll'
174 describe 'visibleに於いて' do
176 @column = @columns['visible']
178 it 'sourceタイプのcolumnである' do
179 expect(@column.type).to eq 'source'
181 it 'マニフェストから設定を取り出している' do
182 expect(@column.item_name).to eq 'scroll'
185 describe 'author_idに於いて' do
187 @column = @columns['author_id']
189 it 'defaultタイプのcolumnである' do
190 expect(@column.type).to eq 'default'
192 it 'マニフェストから設定を取り出している' do
193 expect(@column.item_name).to eq 'scroll'
197 describe 'column_namesに於いて' do
199 @column_names = @my_local_manifest.column_names
202 expect(@column_names.size).to eq 4 + 3
205 expect(@column_names).to eq ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at']
208 describe 'extend_settingsに於いて' do
210 @extend_settings = @my_local_manifest.extend_settings
213 expect(@extend_settings).to be_empty
216 describe 'listsに於いて' do
218 @lists = @my_local_manifest.lists
221 expect(@lists).to be_empty
224 describe 'associationsに於いて' do
226 @associations = @my_local_manifest.associations
228 describe 'belongs_toに於いて' do
230 @belongs_to = @associations.belongs_to
232 it 'これらの所属モデルを取り扱う' do
233 expect(@belongs_to.map {|a| a.name}).to eq ['author']
235 describe 'authorに於いて' do
237 @mani = @belongs_to[0]
239 it 'マニフェストから設定を取り出している' do
240 expect(@mani.name).to eq 'author'
241 expect(@mani.model_name).to eq 'author'
243 it 'サポート機能が動作している' do
244 expect(@mani.model).to eq Author
248 describe 'has_manyに於いて' do
250 @has_many = @associations.has_many
252 it 'これらの所持モデルを取り扱う' do
253 expect(@has_many.map {|a| a.table_name}).to eq ['scroll_panels', 'panels']
255 describe 'scroll_panelsに於いて' do
259 it 'マニフェストから設定を取り出している' do
260 expect(@mani.name).to eq 'scroll_panels.by_scroll'
261 expect(@mani.model_name).to eq 'scroll_panel'
262 expect(@mani.list_name).to eq 'by_scroll'
264 it 'サポート機能が動作している' do
265 expect(@mani.model).to eq ScrollPanel
268 describe 'panels.by_scrollに於いて' do
272 it 'マニフェストから設定を取り出している' do
273 expect(@mani.name).to eq 'panels.by_scroll'
274 expect(@mani.model_name).to eq 'panel'
275 expect(@mani.list_name).to eq 'by_scroll'
277 it 'サポート機能が動作している' do
278 expect(@mani.model).to eq Panel
285 describe 'リストグループに於いて' do
287 @my_local_manifest = LocalManifest.manifest.list_groups[@model.item_name]
289 it 'マニフェストから設定を取り出している' do
290 expect(@my_local_manifest.item_name).to eq @model.item_name
292 describe 'listsに於いて' do
294 @lists = @my_local_manifest.lists
296 it 'これらのリストを定義している' do
297 set_lists? @lists, ['public', 'private', 'by_author', 'by_panel']
299 describe 'publicに於いて' do
301 @mani = @lists['public']
303 it 'マニフェストから設定を取り出している' do
304 expect(@mani.type).to eq 'public'
306 it 'マニフェストから設定を取り出している' do
307 expect(@mani.model).to eq Scroll
309 it 'サポート機能が動作している' do
310 expect(@mani.has_id?).to be nil
311 expect(@mani.pre_id?).to be true
312 expect(@mani.item_name).to eq @model.item_name
314 describe 'whereに於いて' do
319 expect(@where.type).to eq 'auto'
321 it 'サポート機能が動作している' do
322 expect(@where.item_name).to eq @model.item_name
323 expect(@where.list_name).to eq 'public'
324 expect(@where.model).to eq Scroll
327 expect(@where.method_name).to eq 'public_list_where'
330 describe 'includesに於いて' do
332 @includes = @mani.includes
335 expect(@includes.type).to eq 'auto'
337 it 'サポート機能が動作している' do
338 expect(@includes.item_name).to eq @model.item_name
339 expect(@includes.list_name).to eq 'public'
340 expect(@includes.model).to eq Scroll
343 expect(@includes.includes).to be_empty
346 describe 'orderに於いて' do
351 expect(@order.type).to eq 'auto'
353 it 'サポート機能が動作している' do
354 expect(@order.item_name).to eq @model.item_name
355 expect(@order.list_name).to eq 'public'
356 expect(@order.model).to eq Scroll
359 expect(@order.order).to eq 'list_order'
366 describe '入力フォームに於いて' do
368 @my_local_manifest = LocalManifest.manifest.forms[@model.item_name]
370 it 'マニフェストから設定を取り出している' do
371 expect(@my_local_manifest.name).to eq @model.item_name
373 describe 'fieldsに於いて' do
375 @fields = @my_local_manifest.fields
377 # 細かいチェックは後でやるので、大雑把に数量だけチェックしておく。
379 expect(@fields.size).to eq 5
382 describe 'field_namesに於いて' do
384 @field_names = @my_local_manifest.field_names
387 expect(@field_names.size).to eq 5
390 expect(@field_names).to eq ['title', 'description', 'visible', 'id', 'author_id']
394 # 本来fieldsでテストするべき内容だが、並び替えもテストしたいのでこちらで行う。
395 describe 'ordered_fieldsに於いて' do
397 @ordered_fields = @my_local_manifest.ordered_fields
398 @names = ['title', 'description', 'visible', 'id', 'author_id']
400 it 'これらのフィールドを取り扱う' do
401 expect(@ordered_fields.map {|f| f.name }).to eq @names
403 describe 'titleに於いて' do
405 @field = @ordered_fields[0]
407 it 'マニフェストから設定を取り出している' do
408 expect(@field.name).to eq 'title'
409 expect(@field.row_break).to be true
411 it 'サポート機能が動作している' do
412 expect(@field.part?).to be false
413 expect(@field.form_name).to eq @model.item_name
414 expect(@field.column_name).to eq 'title'
415 expect(@field.model_name).to eq @model.item_name
417 describe 'labelに於いて' do
419 @label = @field.label
421 it 'defaultタイプである' do
422 expect(@label.type).to eq 'default'
424 it 'マニフェストから設定を取り出している' do
425 expect(@label.row_break).to be true
427 it 'サポート機能が動作している' do
428 expect(@label.form_name).to eq @model.item_name
429 expect(@label.field_name).to eq 'title'
430 expect(@label.model_name).to eq @model.item_name
431 expect(@label.column_name).to eq 'title'
434 describe 'tagに於いて' do
439 expect(@tag.type).to eq 'text'
441 it 'マニフェストから設定を取り出している' do
442 expect(@tag.options).to_not be_empty
443 expect(@tag.options['size']).to eq 20
445 it 'サポート機能が動作している' do
446 expect(@tag.form_name).to eq @model.item_name
447 expect(@tag.field_name).to eq 'title'
451 describe 'descriptionに於いて' do
453 @field = @ordered_fields[1]
455 it 'マニフェストから設定を取り出している' do
456 expect(@field.name).to eq 'description'
457 expect(@field.row_break).to be true
459 it 'サポート機能が動作している' do
460 expect(@field.part?).to be false
461 expect(@field.form_name).to eq @model.item_name
462 expect(@field.column_name).to eq 'description'
463 expect(@field.model_name).to eq @model.item_name
466 describe 'visibleに於いて' do
468 @field = @ordered_fields[2]
470 it 'マニフェストから設定を取り出している' do
471 expect(@field.name).to eq 'visible'
472 expect(@field.row_break).to be true
474 it 'サポート機能が動作している' do
475 expect(@field.part?).to be false
476 expect(@field.form_name).to eq @model.item_name
477 expect(@field.column_name).to eq 'visible'
478 expect(@field.model_name).to eq @model.item_name
483 @field = @ordered_fields[3]
485 it 'マニフェストから設定を取り出している' do
486 expect(@field.name).to eq 'id'
487 expect(@field.row_break).to be true
489 it 'サポート機能が動作している' do
490 expect(@field.part?).to be false
491 expect(@field.form_name).to eq @model.item_name
492 expect(@field.column_name).to eq 'id'
493 expect(@field.model_name).to eq @model.item_name
496 describe 'author_idに於いて' do
498 @field = @ordered_fields[4]
500 it 'マニフェストから設定を取り出している' do
501 expect(@field.name).to eq 'author_id'
502 expect(@field.row_break).to be true
504 it 'サポート機能が動作している' do
505 expect(@field.part?).to be false
506 expect(@field.form_name).to eq @model.item_name
507 expect(@field.column_name).to eq 'author_id'
508 expect(@field.model_name).to eq @model.item_name
514 describe 'bucketに於いて' do
516 @my_local_manifest = LocalManifest.manifest.buckets[@model.item_name]
518 it 'マニフェストから設定を取り出している' do
519 expect(@my_local_manifest.members).to be_empty
520 expect(@my_local_manifest.form_field_names).to be_empty
522 it 'サポート機能が動作している' do
523 expect(@my_local_manifest.has_member?).to be false
524 expect(@my_local_manifest.item_name).to eq @model.item_name