1 # -*- encoding: utf-8 -*-
6 include ManifestsMacros
11 describe 'ペタナイズに於いて' do
13 expect(@model.ancestors.include?(Peta::Item)).to eq true
16 expect(@model.my_peta.parent_model_name).to be_blank
18 describe 'ブーストに於いて' do
20 expect(@model.my_peta.boost.keys).to be_empty
26 describe 'コントローラに於いて' do
28 @controller = @model.my_controller
30 it 'フォルダのためのコントローラである' do
31 expect(@model.item_name).to eq 'folder'
33 describe 'actionに於いて' do
35 @actions = @controller.actions
36 @actions_names = ['root', 'index', 'show',
38 'new', 'edit', 'destroy']
40 it 'これらのアクションが定義されている' do
41 set_actions? @actions, @actions_names
43 describe 'baseに於いて' do
45 describe 'rootに於いて' do
47 @action = @actions['root']
49 it 'showタイプのアクションである' do
50 expect(@action.type).to eq 'show'
53 describe 'indexに於いて' do
55 @action = @actions['index']
57 it 'listタイプのアクションである' do
58 expect(@action.type).to eq 'list'
60 it 'マニフェストから設定を取り出している' do
61 # フォルダの公開リストを返すように定義している
62 set_list_action? @action, 'folder', 'public'
65 describe 'showに於いて' do
67 @action = @actions['show']
69 it 'showタイプのアクションである' do
70 expect(@action.type).to eq 'show'
73 describe 'countに於いて' do
75 @action = @actions['count']
77 it 'countタイプのアクションである' do
78 expect(@action.type).to eq 'count'
80 it 'マニフェストから設定を取り出している' do
81 #フォルダの公開リストのカウントを返すように定義している
82 set_list_action? @action, 'folder', 'public'
87 @action = @actions['new']
89 it 'newタイプのアクションである' do
90 expect(@action.type).to eq 'new'
93 expect(@action.item_name).to eq 'folder'
96 describe 'editに於いて' do
98 @action = @actions['edit']
100 it 'editタイプのアクションである' do
101 expect(@action.type).to eq 'edit'
104 expect(@action.item_name).to eq 'folder'
107 describe 'destroyに於いて' do
109 @action = @actions['destroy']
111 it 'destroyタイプのアクションである' do
112 expect(@action.type).to eq 'destroy'
115 expect(@action.item_name).to eq 'folder'
122 describe 'モデルに於いて' do
124 @my_manifest = @model.my_manifest
126 it 'サポート機能が動作している' do
127 expect(@my_manifest.model_name).to eq 'folder'
128 expect(@my_manifest.classify).to eq @model
129 expect(@my_manifest.table_name).to eq 'folders'
132 describe 'associationsに於いて' do
133 describe 'belongs_toに於いて' do
135 @belongs_to = @my_manifest.associations.belongs_to
138 it 'これらのモデルに所属している' do
139 set_associations? @belongs_to, @names
142 describe 'has_manyに於いて' do
144 @has_many = @model.my_manifest.associations.has_many
147 it 'これらのモデルを所持している' do
148 set_associations? @has_many, @names
153 describe 'attributesに於いて' do
155 @attributes = @model.my_manifest.attributes
157 it 'これらのカラムを定義している' do
158 set_attributes? @attributes,
159 ['id', 'name', 'controller_name', 'action_name', 'category_id',
160 't', 'parent_id', 'lft', 'rgt', 'depth',
161 'created_at', 'updated_at']
163 describe 'nameに於いて' do
165 @attribute = @attributes['name']
168 expect(@attribute.type).to eq 'text'
171 describe 'controller_nameに於いて' do
173 @attribute = @attributes['controller_name']
176 expect(@attribute.type).to eq 'text'
179 describe 'action_nameに於いて' do
181 @attribute = @attributes['action_name']
184 expect(@attribute.type).to eq 'text'
187 describe 'category_idに於いて' do
189 @attribute = @attributes['category_id']
192 expect(@attribute.type).to eq 'number'
197 @attribute = @attributes['t']
200 expect(@attribute.type).to eq 'number'
203 describe 'parent_idに於いて' do
205 @attribute = @attributes['parent_id']
208 expect(@attribute.type).to eq 'number'
211 describe 'lftに於いて' do
213 @attribute = @attributes['lft']
216 expect(@attribute.type).to eq 'number'
219 describe 'rgtに於いて' do
221 @attribute = @attributes['rgt']
224 expect(@attribute.type).to eq 'number'
227 describe 'depthに於いて' do
229 @attribute = @attributes['depth']
232 expect(@attribute.type).to eq 'number'