OSDN Git Service

Merge branch 'v06' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v06
[pettanr/pettanr.git] / spec / local_manifests / scroll_spec.rb
1 # -*- encoding: utf-8 -*-
2 require 'spec_helper'
3 #スクロールマニフェスト
4
5 describe Scroll do
6   before do
7     @model = Scroll
8   end
9   
10   describe 'ファイラーに於いて' do
11     before do
12       @my_local_manifest = LocalManifest.manifest.filers[@model.item_name]
13     end
14     it ' 項はない' do
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
18     end
19     describe 'symbolに於いて' do
20       before do
21         @symbol = @my_local_manifest.symbol
22       end
23       it 'type' do
24         expect(@symbol.type).to eq 'default'
25       end
26       it 'type' do
27         expect(@symbol.visible?).to be true
28       end
29       describe 'faceに於いて' do
30         before do
31           @face = @symbol.face
32         end
33         it 'type' do
34           expect(@face.type).to eq 'image'
35         end
36         it 'type' do
37           expect(@face.url).to eq '/images/scroll.gif'
38         end
39       end
40       describe 'linkに於いて' do
41         before do
42           @link = @symbol.link
43         end
44         it 'type' do
45           expect(@link.type).to eq 'action'
46         end
47         it 'type' do
48           expect(@link.action_name).to eq 'show'
49         end
50         it 'type' do
51           expect(@link.action_path).to eq '/scrolls/'
52         end
53       end
54     end
55     describe 'captionに於いて' do
56       before do
57         @caption = @my_local_manifest.caption
58       end
59       it 'type' do
60         expect(@caption.type).to eq 'default'
61       end
62       it 'type' do
63         expect(@caption.visible?).to be true
64       end
65       describe 'faceに於いて' do
66         before do
67           @face = @caption.face
68         end
69         it 'type' do
70           expect(@face.type).to eq 'column'
71         end
72         it 'type' do
73           expect(@face.column_name).to eq 'title'
74         end
75       end
76       describe 'linkに於いて' do
77         before do
78           @link = @caption.link
79         end
80         it 'type' do
81           expect(@link.type).to eq 'action'
82         end
83         it 'type' do
84           expect(@link.action_name).to eq 'play'
85         end
86         it 'type' do
87           expect(@link.action_path).to eq '/scrolls/play/'
88         end
89       end
90     end
91     describe 'summaryに於いて' do
92       before do
93         @summary = @my_local_manifest.summary
94       end
95       it 'type' do
96         expect(@summary.type).to eq 'template'
97       end
98       it 'type' do
99         expect(@summary.template_name).to eq 'summary'
100       end
101     end
102     describe 'iconに於いて' do
103       before do
104         @icon = @my_local_manifest.icon
105       end
106       it 'type' do
107         expect(@icon.type).to eq 'default'
108       end
109       it 'type' do
110         expect(@icon.visible?).to be true
111       end
112     end
113     describe 'dateに於いて' do
114       before do
115         @date = @my_local_manifest.date
116       end
117       it 'type' do
118         expect(@date.type).to eq 'default'
119       end
120       it 'type' do
121         expect(@date.visible?).to be true
122       end
123     end
124     describe 'editに於いて' do
125       before do
126         @edit = @my_local_manifest.edit
127       end
128       it 'type' do
129         expect(@edit.type).to eq 'default'
130       end
131       it 'type' do
132         expect(@edit.visible?).to be true
133       end
134     end
135   end
136   
137   describe 'プロファイラーに於いて' do
138     before do
139       @my_local_manifest = LocalManifest.manifest.profilers[@model.item_name]
140     end
141     it ' 項はない' do
142       expect(@my_local_manifest.item_name).to eq @model.item_name
143     end
144     describe 'columnsに於いて' do
145       before do
146         @columns = @my_local_manifest.columns
147       end
148       it 'type' do
149         expect(@columns.size).to eq 4 + 3
150         expect(@columns.keys).to include 'title'
151         expect(@columns.keys).to include 'description'
152         expect(@columns.keys).to include 'visible'
153         expect(@columns.keys).to include 'author_id'
154       end
155       describe 'titleに於いて' do
156         before do
157           @column = @columns['title']
158         end
159         it 'type' do
160           expect(@column.type).to eq 'default'
161         end
162         it 'type' do
163           expect(@column.item_name).to eq 'scroll'
164         end
165       end
166       describe 'descriptionに於いて' do
167         before do
168           @column = @columns['description']
169         end
170         it 'type' do
171           expect(@column.type).to eq 'default'
172         end
173         it 'type' do
174           expect(@column.item_name).to eq 'scroll'
175         end
176       end
177       describe 'visibleに於いて' do
178         before do
179           @column = @columns['visible']
180         end
181         it 'type' do
182           expect(@column.type).to eq 'source'
183         end
184         it 'type' do
185           expect(@column.item_name).to eq 'scroll'
186         end
187       end
188       describe 'author_idに於いて' do
189         before do
190           @column = @columns['author_id']
191         end
192         it 'type' do
193           expect(@column.type).to eq 'default'
194         end
195         it 'type' do
196           expect(@column.item_name).to eq 'scroll'
197         end
198       end
199     end
200     describe 'column_namesに於いて' do
201       before do
202         @column_names = @my_local_manifest.column_names
203       end
204       it 'type' do
205         expect(@column_names.size).to eq 4 + 3
206       end
207       it 'type' do
208         expect(@column_names).to eq ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at']
209       end
210     end
211     describe 'extend_settingsに於いて' do
212       before do
213         @extend_settings = @my_local_manifest.extend_settings
214       end
215       it 'type' do
216         expect(@extend_settings).to be_empty
217       end
218     end
219     describe 'listsに於いて' do
220       before do
221         @lists = @my_local_manifest.lists
222       end
223       it 'type' do
224         expect(@lists).to be_empty
225       end
226     end
227     describe 'associationsに於いて' do
228       before do
229         @associations = @my_local_manifest.associations
230       end
231       describe 'belongs_toに於いて' do
232         before do
233           @belongs_to = @associations.belongs_to
234         end
235         describe 'authorに於いて' do
236           before do
237             @mani = @belongs_to[0]
238           end
239           it 'type' do
240             expect(@mani.name).to eq 'author'
241             expect(@mani.model_name).to eq 'author'
242           end
243           it 'type' do
244             expect(@mani.model).to eq Author
245           end
246         end
247       end
248       describe 'has_manyに於いて' do
249         before do
250           @has_many = @associations.has_many
251         end
252         describe 'scroll_panelsに於いて' do
253           before do
254             @mani = @has_many[0]
255           end
256           it 'type' do
257             expect(@mani.name).to eq 'scroll_panels.by_scroll'
258             expect(@mani.model_name).to eq 'scroll_panel'
259             expect(@mani.list_name).to eq 'by_scroll'
260           end
261           it 'type' do
262             expect(@mani.model).to eq ScrollPanel
263           end
264         end
265         describe 'panels.by_scrollに於いて' do
266           before do
267             @mani = @has_many[1]
268           end
269           it 'type' do
270             expect(@mani.name).to eq 'panels.by_scroll'
271             expect(@mani.model_name).to eq 'panel'
272             expect(@mani.list_name).to eq 'by_scroll'
273           end
274           it 'type' do
275             expect(@mani.model).to eq Panel
276           end
277         end
278       end
279     end
280   end
281   
282   describe 'リストグループに於いて' do
283     before do
284       @my_local_manifest = LocalManifest.manifest.list_groups[@model.item_name]
285     end
286     it ' 項はない' do
287       expect(@my_local_manifest.item_name).to eq @model.item_name
288     end
289     describe 'listsに於いて' do
290       before do
291         @lists = @my_local_manifest.lists
292       end
293       it 'type' do
294         expect(@lists.size).to eq 4
295         expect(@lists.keys).to include 'public'
296         expect(@lists.keys).to include 'private'
297         expect(@lists.keys).to include 'by_author'
298         expect(@lists.keys).to include 'by_panel'
299       end
300       describe 'publicに於いて' do
301         before do
302           @mani = @lists['public']
303         end
304         it 'type' do
305           expect(@mani.type).to eq 'public'
306           expect(@mani.model).to eq Scroll
307         end
308         it 'base' do
309           expect(@mani.has_id?).to eq true
310           expect(@mani.pre_id?).to eq false
311           expect(@mani.item_name).to eq @model.item_name
312         end
313         describe 'whereに於いて' do
314           before do
315             @where = @mani.where
316           end
317           it 'type' do
318             expect(@where.type).to eq 'auto'
319             expect(@where.item_name).to eq @model.item_name
320             expect(@where.list_name).to eq 'public'
321             expect(@where.model).to eq Scroll
322           end
323           it 'type' do
324             expect(@where.method_name).to eq 'public_list_where'
325           end
326         end
327         describe 'includesに於いて' do
328           before do
329             @includes = @mani.includes
330           end
331           it 'type' do
332             expect(@includes.type).to eq 'auto'
333             expect(@includes.item_name).to eq @model.item_name
334             expect(@includes.list_name).to eq 'public'
335             expect(@includes.model).to eq Scroll
336           end
337           it 'type' do
338             expect(@includes.includes).to eq {}
339           end
340         end
341         describe 'orderに於いて' do
342           before do
343             @order = @mani.order
344           end
345           it 'type' do
346             expect(@order.type).to eq 'auto'
347             expect(@order.item_name).to eq @model.item_name
348             expect(@order.list_name).to eq 'public'
349             expect(@order.model).to eq Scroll
350           end
351           it 'type' do
352             expect(@order.order).to eq 'list_order'
353           end
354         end
355       end
356     end
357   end
358   
359   describe '入力フォームに於いて' do
360     before do
361       @my_local_manifest = LocalManifest.manifest.forms[@model.item_name]
362     end
363     it ' 項はない' do
364       expect(@my_local_manifest.name).to eq @model.item_name
365     end
366     describe 'fieldsに於いて' do
367       before do
368         @fields = @my_local_manifest.fields
369       end
370       it 'type' do
371         expect(@fields.size).to eq 5
372         expect(@fields.keys).to include 'title'
373         expect(@fields.keys).to include 'description'
374         expect(@fields.keys).to include 'visible'
375         expect(@fields.keys).to include 'id'
376         expect(@fields.keys).to include 'author_id'
377       end
378     end
379     describe 'field_namesに於いて' do
380       before do
381         @field_names = @my_local_manifest.field_names
382       end
383       it 'type' do
384         expect(@field_names.size).to eq 5
385       end
386     end
387     describe 'ordered_fieldsに於いて' do
388       before do
389         @ordered_fields = @my_local_manifest.ordered_fields
390       end
391       it 'type' do
392         expect(@ordered_fields.size).to eq 5
393       end
394       describe 'titleに於いて' do
395         before do
396           @field = @ordered_fields[0]
397         end
398         it 'type' do
399           expect(@field.name).to eq 'title'
400           expect(@field.row_break).to be true
401         end
402         it 'type' do
403           expect(@field.part?).to be false
404           expect(@field.form_name).to eq @model.item_name
405           expect(@field.column_name).to eq 'title'
406           expect(@field.model_name).to eq @model.item_name
407         end
408         describe 'labelに於いて' do
409           before do
410             @label = @field.label
411           end
412           it 'type' do
413             expect(@label.type).to eq 'default'
414             expect(@label.row_break).to be true
415           end
416           it 'type' do
417             expect(@label.form_name).to eq @model.item_name
418             expect(@label.field_name).to eq 'title'
419             expect(@label.model_name).to eq @model.item_name
420             expect(@label.column_name).to eq 'title'
421           end
422         end
423         describe 'tagに於いて' do
424           before do
425             @tag = @field.tag
426           end
427           it 'type' do
428             expect(@tag.type).to eq 'text'
429             expect(@tag.options).to_not be_empty
430             expect(@tag.options['size']).to eq 20
431           end
432           it 'type' do
433             expect(@tag.form_name).to eq @model.item_name
434             expect(@tag.field_name).to eq 'title'
435           end
436         end
437       end
438       describe 'descriptionに於いて' do
439         before do
440           @field = @ordered_fields[1]
441         end
442         it 'type' do
443           expect(@field.name).to eq 'description'
444           expect(@field.row_break).to be true
445         end
446         it 'type' do
447           expect(@field.part?).to be false
448           expect(@field.form_name).to eq @model.item_name
449           expect(@field.column_name).to eq 'description'
450           expect(@field.model_name).to eq @model.item_name
451         end
452       end
453       describe 'visibleに於いて' do
454         before do
455           @field = @ordered_fields[2]
456         end
457         it 'type' do
458           expect(@field.name).to eq 'visible'
459           expect(@field.row_break).to be true
460         end
461         it 'type' do
462           expect(@field.part?).to be false
463           expect(@field.form_name).to eq @model.item_name
464           expect(@field.column_name).to eq 'visible'
465           expect(@field.model_name).to eq @model.item_name
466         end
467       end
468       describe 'idに於いて' do
469         before do
470           @field = @ordered_fields[3]
471         end
472         it 'type' do
473           expect(@field.name).to eq 'id'
474           expect(@field.row_break).to be true
475         end
476         it 'type' do
477           expect(@field.part?).to be false
478           expect(@field.form_name).to eq @model.item_name
479           expect(@field.column_name).to eq 'id'
480           expect(@field.model_name).to eq @model.item_name
481         end
482       end
483       describe 'author_idに於いて' do
484         before do
485           @field = @ordered_fields[4]
486         end
487         it 'type' do
488           expect(@field.name).to eq 'author_id'
489           expect(@field.row_break).to be true
490         end
491         it 'type' do
492           expect(@field.part?).to be false
493           expect(@field.form_name).to eq @model.item_name
494           expect(@field.column_name).to eq 'author_id'
495           expect(@field.model_name).to eq @model.item_name
496         end
497       end
498     end
499   end
500   
501   describe 'bucketに於いて' do
502     before do
503       @my_local_manifest = LocalManifest.manifest.buckets[@model.item_name]
504     end
505     it ' 項はない' do
506       expect(@my_local_manifest.members).to be_empty
507       expect(@my_local_manifest.form_field_names).to be_empty
508     end
509     it ' 項はない' do
510       expect(@my_local_manifest.has_member?).to be false
511       expect(@my_local_manifest.item_name).to eq @model.item_name
512     end
513   end
514   
515 end