1 # -*- encoding: utf-8 -*-
\r
3 require 'spec_helper'
\r
6 include LocalManifestsMacros
\r
11 describe 'ファイラーに於いて' do
\r
13 @my_local_manifest = LocalManifest.manifest.filers[@model.item_name]
\r
15 it 'サポート機能が動作している' do
\r
16 expect(@my_local_manifest.item_class).to eq @model
\r
17 expect(@my_local_manifest.item_name).to eq @model.item_name
\r
18 expect(@my_local_manifest.filer_name).to eq @model.item_name
\r
20 describe 'symbolに於いて' do
\r
22 @symbol = @my_local_manifest.symbol
\r
24 it 'defaultタイプのsymbolである' do
\r
25 expect(@symbol.type).to eq 'default'
\r
27 it 'サポート機能が動作している' do
\r
28 expect(@symbol.visible?).to be true
\r
30 describe 'faceに於いて' do
\r
32 @face = @symbol.face
\r
34 it 'imageタイプのfaceである' do
\r
35 expect(@face.type).to eq 'image'
\r
37 it 'マニフェストから設定を取り出している' do
\r
38 expect(@face.url).to eq '/images/scroll.gif'
\r
41 describe 'linkに於いて' do
\r
43 @link = @symbol.link
\r
45 it 'actionタイプのlinkである' do
\r
46 expect(@link.type).to eq 'action'
\r
48 it 'マニフェストから設定を取り出している' do
\r
49 expect(@link.action_name).to eq 'show'
\r
51 it 'サポート機能が動作している' do
\r
52 expect(@link.action_path).to eq '/scrolls/'
\r
56 describe 'captionに於いて' do
\r
58 @caption = @my_local_manifest.caption
\r
60 it 'defaultタイプのsymbolである' do
\r
61 expect(@caption.type).to eq 'default'
\r
63 it 'サポート機能が動作している' do
\r
64 expect(@caption.visible?).to be true
\r
66 describe 'faceに於いて' do
\r
68 @face = @caption.face
\r
70 it 'columnタイプのfaceである' do
\r
71 expect(@face.type).to eq 'column'
\r
73 it 'マニフェストから設定を取り出している' do
\r
74 expect(@face.column_name).to eq 'title'
\r
77 describe 'linkに於いて' do
\r
79 @link = @caption.link
\r
81 it 'actionタイプのlinkである' do
\r
82 expect(@link.type).to eq 'action'
\r
84 it 'マニフェストから設定を取り出している' do
\r
85 expect(@link.action_name).to eq 'play'
\r
87 it 'サポート機能が動作している' do
\r
88 expect(@link.action_path).to eq '/scrolls/play/'
\r
92 describe 'summaryに於いて' do
\r
94 @summary = @my_local_manifest.summary
\r
96 it 'templateタイプのsymbolである' do
\r
97 expect(@summary.type).to eq 'template'
\r
99 it 'マニフェストから設定を取り出している' do
\r
100 expect(@summary.template_name).to eq 'summary'
\r
103 describe 'iconに於いて' do
\r
105 @icon = @my_local_manifest.icon
\r
107 it 'defaultタイプのsymbolである' do
\r
108 expect(@icon.type).to eq 'default'
\r
110 it 'サポート機能が動作している' do
\r
111 expect(@icon.visible?).to be true
\r
114 describe 'dateに於いて' do
\r
116 @date = @my_local_manifest.date
\r
118 it 'defaultタイプのsymbolである' do
\r
119 expect(@date.type).to eq 'default'
\r
121 it 'サポート機能が動作している' do
\r
122 expect(@date.visible?).to be true
\r
125 describe 'editに於いて' do
\r
127 @edit = @my_local_manifest.edit
\r
129 it 'defaultタイプのsymbolである' do
\r
130 expect(@edit.type).to eq 'default'
\r
132 it 'サポート機能が動作している' do
\r
133 expect(@edit.visible?).to be true
\r
138 describe 'プロファイラーに於いて' do
\r
140 @my_local_manifest = LocalManifest.manifest.profilers[@model.item_name]
\r
142 it 'マニフェストから設定を取り出している' do
\r
143 expect(@my_local_manifest.item_name).to eq @model.item_name
\r
145 describe 'columnsに於いて' do
\r
147 @columns = @my_local_manifest.columns
\r
148 @names = ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at']
\r
150 it 'これらのカラムが定義されている' do
\r
151 set_columns? @columns, @names
\r
153 describe 'titleに於いて' do
\r
155 @column = @columns['title']
\r
157 it 'defaultタイプのcolumnである' do
\r
158 expect(@column.type).to eq 'default'
\r
160 it 'マニフェストから設定を取り出している' do
\r
161 expect(@column.item_name).to eq 'scroll'
\r
164 describe 'descriptionに於いて' do
\r
166 @column = @columns['description']
\r
168 it 'defaultタイプのcolumnである' do
\r
169 expect(@column.type).to eq 'default'
\r
171 it 'マニフェストから設定を取り出している' do
\r
172 expect(@column.item_name).to eq 'scroll'
\r
175 describe 'visibleに於いて' do
\r
177 @column = @columns['visible']
\r
179 it 'sourceタイプのcolumnである' do
\r
180 expect(@column.type).to eq 'source'
\r
182 it 'マニフェストから設定を取り出している' do
\r
183 expect(@column.item_name).to eq 'scroll'
\r
186 describe 'author_idに於いて' do
\r
188 @column = @columns['author_id']
\r
190 it 'defaultタイプのcolumnである' do
\r
191 expect(@column.type).to eq 'default'
\r
193 it 'マニフェストから設定を取り出している' do
\r
194 expect(@column.item_name).to eq 'scroll'
\r
198 describe 'column_namesに於いて' do
\r
200 @column_names = @my_local_manifest.column_names
\r
203 expect(@column_names.size).to eq 4 + 3
\r
206 expect(@column_names).to eq ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at']
\r
209 describe 'extend_settingsに於いて' do
\r
211 @extend_settings = @my_local_manifest.extend_settings
\r
214 expect(@extend_settings).to be_empty
\r
217 describe 'listsに於いて' do
\r
219 @lists = @my_local_manifest.lists
\r
222 expect(@lists).to be_empty
\r
225 describe 'associationsに於いて' do
\r
227 @associations = @my_local_manifest.associations
\r
229 describe 'belongs_toに於いて' do
\r
231 @belongs_to = @associations.belongs_to
\r
233 it 'これらの所属モデルを取り扱う' do
\r
234 expect(@belongs_to.map {|a| a.name}).to eq ['author']
\r
236 describe 'authorに於いて' do
\r
238 @mani = @belongs_to[0]
\r
240 it 'マニフェストから設定を取り出している' do
\r
241 expect(@mani.name).to eq 'author'
\r
242 expect(@mani.model_name).to eq 'author'
\r
244 it 'サポート機能が動作している' do
\r
245 expect(@mani.model).to eq Author
\r
249 describe 'has_manyに於いて' do
\r
251 @has_many = @associations.has_many
\r
253 it 'これらの所持モデルを取り扱う' do
\r
254 expect(@has_many.map {|a| a.table_name}).to eq ['scroll_panels', 'panels']
\r
256 describe 'scroll_panelsに於いて' do
\r
258 @mani = @has_many[0]
\r
260 it 'マニフェストから設定を取り出している' do
\r
261 expect(@mani.name).to eq 'scroll_panels.by_scroll'
\r
262 expect(@mani.model_name).to eq 'scroll_panel'
\r
263 expect(@mani.list_name).to eq 'by_scroll'
\r
265 it 'サポート機能が動作している' do
\r
266 expect(@mani.model).to eq ScrollPanel
\r
269 describe 'panels.by_scrollに於いて' do
\r
271 @mani = @has_many[1]
\r
273 it 'マニフェストから設定を取り出している' do
\r
274 expect(@mani.name).to eq 'panels.by_scroll'
\r
275 expect(@mani.model_name).to eq 'panel'
\r
276 expect(@mani.list_name).to eq 'by_scroll'
\r
278 it 'サポート機能が動作している' do
\r
279 expect(@mani.model).to eq Panel
\r
286 describe 'リストグループに於いて' do
\r
288 @my_local_manifest = LocalManifest.manifest.list_groups[@model.item_name]
\r
290 it 'マニフェストから設定を取り出している' do
\r
291 expect(@my_local_manifest.item_name).to eq @model.item_name
\r
293 describe 'listsに於いて' do
\r
295 @lists = @my_local_manifest.lists
\r
297 it 'これらのリストを定義している' do
\r
298 set_lists? @lists, ['public', 'private', 'by_author', 'by_panel']
\r
300 describe 'publicに於いて' do
\r
302 @mani = @lists['public']
\r
304 it 'マニフェストから設定を取り出している' do
\r
305 expect(@mani.type).to eq 'public'
\r
307 it 'マニフェストから設定を取り出している' do
\r
308 expect(@mani.model).to eq Scroll
\r
310 it 'サポート機能が動作している' do
\r
311 expect(@mani.has_id?).to be nil
\r
312 expect(@mani.pre_id?).to be true
\r
313 expect(@mani.item_name).to eq @model.item_name
\r
315 describe 'whereに於いて' do
\r
317 @where = @mani.where
\r
320 expect(@where.type).to eq 'auto'
\r
322 it 'サポート機能が動作している' do
\r
323 expect(@where.item_name).to eq @model.item_name
\r
324 expect(@where.list_name).to eq 'public'
\r
325 expect(@where.model).to eq Scroll
\r
327 it 'method_name' do
\r
328 expect(@where.method_name).to eq 'public_list_where'
\r
331 describe 'includesに於いて' do
\r
333 @includes = @mani.includes
\r
336 expect(@includes.type).to eq 'auto'
\r
338 it 'サポート機能が動作している' do
\r
339 expect(@includes.item_name).to eq @model.item_name
\r
340 expect(@includes.list_name).to eq 'public'
\r
341 expect(@includes.model).to eq Scroll
\r
344 expect(@includes.includes).to be_empty
\r
347 describe 'orderに於いて' do
\r
349 @order = @mani.order
\r
352 expect(@order.type).to eq 'auto'
\r
354 it 'サポート機能が動作している' do
\r
355 expect(@order.item_name).to eq @model.item_name
\r
356 expect(@order.list_name).to eq 'public'
\r
357 expect(@order.model).to eq Scroll
\r
360 expect(@order.order).to eq 'list_order'
\r
367 describe '入力フォームに於いて' do
\r
369 @my_local_manifest = LocalManifest.manifest.forms[@model.item_name]
\r
371 it 'マニフェストから設定を取り出している' do
\r
372 expect(@my_local_manifest.name).to eq @model.item_name
\r
374 describe 'fieldsに於いて' do
\r
376 @fields = @my_local_manifest.fields
\r
378 # 細かいチェックは後でやるので、大雑把に数量だけチェックしておく。
\r
380 expect(@fields.size).to eq 5
\r
383 describe 'field_namesに於いて' do
\r
385 @field_names = @my_local_manifest.field_names
\r
388 expect(@field_names.size).to eq 5
\r
391 expect(@field_names).to eq ['title', 'description', 'visible', 'id', 'author_id']
\r
394 # 処理順に並べられたフィールドのこと
\r
395 # 本来fieldsでテストするべき内容だが、並び替えもテストしたいのでこちらで行う。
\r
396 describe 'ordered_fieldsに於いて' do
\r
398 @ordered_fields = @my_local_manifest.ordered_fields
\r
399 @names = ['title', 'description', 'visible', 'id', 'author_id']
\r
401 it 'これらのフィールドを取り扱う' do
\r
402 expect(@ordered_fields.map {|f| f.name }).to eq @names
\r
404 describe 'titleに於いて' do
\r
406 @field = @ordered_fields[0]
\r
408 it 'マニフェストから設定を取り出している' do
\r
409 expect(@field.name).to eq 'title'
\r
410 expect(@field.row_break).to be true
\r
412 it 'サポート機能が動作している' do
\r
413 expect(@field.part?).to be false
\r
414 expect(@field.form_name).to eq @model.item_name
\r
415 expect(@field.column_name).to eq 'title'
\r
416 expect(@field.model_name).to eq @model.item_name
\r
418 describe 'labelに於いて' do
\r
420 @label = @field.label
\r
422 it 'defaultタイプである' do
\r
423 expect(@label.type).to eq 'default'
\r
425 it 'マニフェストから設定を取り出している' do
\r
426 expect(@label.row_break).to be true
\r
428 it 'サポート機能が動作している' do
\r
429 expect(@label.form_name).to eq @model.item_name
\r
430 expect(@label.field_name).to eq 'title'
\r
431 expect(@label.model_name).to eq @model.item_name
\r
432 expect(@label.column_name).to eq 'title'
\r
435 describe 'tagに於いて' do
\r
440 expect(@tag.type).to eq 'text'
\r
442 it 'マニフェストから設定を取り出している' do
\r
443 expect(@tag.options).to_not be_empty
\r
444 expect(@tag.options['size']).to eq 20
\r
446 it 'サポート機能が動作している' do
\r
447 expect(@tag.form_name).to eq @model.item_name
\r
448 expect(@tag.field_name).to eq 'title'
\r
452 describe 'descriptionに於いて' do
\r
454 @field = @ordered_fields[1]
\r
456 it 'マニフェストから設定を取り出している' do
\r
457 expect(@field.name).to eq 'description'
\r
458 expect(@field.row_break).to be true
\r
460 it 'サポート機能が動作している' do
\r
461 expect(@field.part?).to be false
\r
462 expect(@field.form_name).to eq @model.item_name
\r
463 expect(@field.column_name).to eq 'description'
\r
464 expect(@field.model_name).to eq @model.item_name
\r
467 describe 'visibleに於いて' do
\r
469 @field = @ordered_fields[2]
\r
471 it 'マニフェストから設定を取り出している' do
\r
472 expect(@field.name).to eq 'visible'
\r
473 expect(@field.row_break).to be true
\r
475 it 'サポート機能が動作している' do
\r
476 expect(@field.part?).to be false
\r
477 expect(@field.form_name).to eq @model.item_name
\r
478 expect(@field.column_name).to eq 'visible'
\r
479 expect(@field.model_name).to eq @model.item_name
\r
482 describe 'idに於いて' do
\r
484 @field = @ordered_fields[3]
\r
486 it 'マニフェストから設定を取り出している' do
\r
487 expect(@field.name).to eq 'id'
\r
488 expect(@field.row_break).to be true
\r
490 it 'サポート機能が動作している' do
\r
491 expect(@field.part?).to be false
\r
492 expect(@field.form_name).to eq @model.item_name
\r
493 expect(@field.column_name).to eq 'id'
\r
494 expect(@field.model_name).to eq @model.item_name
\r
497 describe 'author_idに於いて' do
\r
499 @field = @ordered_fields[4]
\r
501 it 'マニフェストから設定を取り出している' do
\r
502 expect(@field.name).to eq 'author_id'
\r
503 expect(@field.row_break).to be true
\r
505 it 'サポート機能が動作している' do
\r
506 expect(@field.part?).to be false
\r
507 expect(@field.form_name).to eq @model.item_name
\r
508 expect(@field.column_name).to eq 'author_id'
\r
509 expect(@field.model_name).to eq @model.item_name
\r
515 describe 'bucketに於いて' do
\r
517 @my_local_manifest = LocalManifest.manifest.buckets[@model.item_name]
\r
519 it 'マニフェストから設定を取り出している' do
\r
520 expect(@my_local_manifest.members).to be_empty
\r
521 expect(@my_local_manifest.form_field_names).to be_empty
\r
523 it 'サポート機能が動作している' do
\r
524 expect(@my_local_manifest.has_member?).to be false
\r
525 expect(@my_local_manifest.item_name).to eq @model.item_name
\r