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