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