--- /dev/null
+# -*- encoding: utf-8 -*-
+require 'spec_helper'
+# フォルダ
+
+describe Folder do
+ include ManifestsMacros
+ before do
+ @model = Folder
+ end
+
+ describe 'ペタナイズに於いて' do
+ it 'アイテムである' do
+ expect(@model.ancestors.include?(Peta::Item)).to eq true
+ end
+ it '親モデルは持たない' do
+ expect(@model.my_peta.parent_model_name).to be_blank
+ end
+ describe 'ブーストに於いて' do
+ it '特筆すべき注意事項はない' do
+ expect(@model.my_peta.boost.keys).to be_empty
+ end
+ end
+
+ end
+
+ describe 'コントローラに於いて' do
+ before do
+ @controller = @model.my_controller
+ end
+ it 'フォルダのためのコントローラである' do
+ expect(@model.item_name).to eq 'folder'
+ end
+ describe 'actionに於いて' do
+ before do
+ @actions = @controller.actions
+ @actions_names = ['root', 'index', 'show',
+ 'count',
+ 'new', 'edit', 'destroy']
+ end
+ it 'これらのアクションが定義されている' do
+ set_actions? @actions, @actions_names
+ end
+ describe 'baseに於いて' do
+ end
+ describe 'rootに於いて' do
+ before do
+ @action = @actions['root']
+ end
+ it 'showタイプのアクションである' do
+ expect(@action.type).to eq 'show'
+ end
+ end
+ describe 'indexに於いて' do
+ before do
+ @action = @actions['index']
+ end
+ it 'listタイプのアクションである' do
+ expect(@action.type).to eq 'list'
+ end
+ it 'マニフェストから設定を取り出している' do
+ # フォルダの公開リストを返すように定義している
+ set_list_action? @action, 'folder', 'public'
+ end
+ end
+ describe 'showに於いて' do
+ before do
+ @action = @actions['show']
+ end
+ it 'showタイプのアクションである' do
+ expect(@action.type).to eq 'show'
+ end
+ end
+ describe 'countに於いて' do
+ before do
+ @action = @actions['count']
+ end
+ it 'countタイプのアクションである' do
+ expect(@action.type).to eq 'count'
+ end
+ it 'マニフェストから設定を取り出している' do
+ #フォルダの公開リストのカウントを返すように定義している
+ set_list_action? @action, 'folder', 'public'
+ end
+ end
+ describe 'newに於いて' do
+ before do
+ @action = @actions['new']
+ end
+ it 'newタイプのアクションである' do
+ expect(@action.type).to eq 'new'
+ end
+ it 'type' do
+ expect(@action.item_name).to eq 'folder'
+ end
+ end
+ describe 'editに於いて' do
+ before do
+ @action = @actions['edit']
+ end
+ it 'editタイプのアクションである' do
+ expect(@action.type).to eq 'edit'
+ end
+ it 'type' do
+ expect(@action.item_name).to eq 'folder'
+ end
+ end
+ describe 'destroyに於いて' do
+ before do
+ @action = @actions['destroy']
+ end
+ it 'destroyタイプのアクションである' do
+ expect(@action.type).to eq 'destroy'
+ end
+ it 'type' do
+ expect(@action.item_name).to eq 'folder'
+ end
+ end
+ end
+
+ end
+
+ describe 'モデルに於いて' do
+ before do
+ @my_manifest = @model.my_manifest
+ end
+ it 'サポート機能が動作している' do
+ expect(@my_manifest.model_name).to eq 'folder'
+ expect(@my_manifest.classify).to eq @model
+ expect(@my_manifest.table_name).to eq 'folders'
+ end
+
+ describe 'associationsに於いて' do
+ describe 'belongs_toに於いて' do
+ before do
+ @belongs_to = @my_manifest.associations.belongs_to
+ @names = []
+ end
+ it 'これらのモデルに所属している' do
+ set_associations? @belongs_to, @names
+ end
+ end
+ describe 'has_manyに於いて' do
+ before do
+ @has_many = @model.my_manifest.associations.has_many
+ @names = []
+ end
+ it 'これらのモデルを所持している' do
+ set_associations? @has_many, @names
+ end
+ end
+ end
+
+ describe 'attributesに於いて' do
+ before do
+ @attributes = @model.my_manifest.attributes
+ end
+ it 'これらのカラムを定義している' do
+ set_attributes? @attributes,
+ ['id', 'name', 'controller_name', 'action_name', 'category_id',
+ 't', 'parent_id', 'lft', 'rgt', 'depth',
+ 'created_at', 'updated_at']
+ end
+ describe 'nameに於いて' do
+ before do
+ @attribute = @attributes['name']
+ end
+ it 'textタイプである' do
+ expect(@attribute.type).to eq 'text'
+ end
+ end
+ describe 'controller_nameに於いて' do
+ before do
+ @attribute = @attributes['controller_name']
+ end
+ it 'textタイプである' do
+ expect(@attribute.type).to eq 'text'
+ end
+ end
+ describe 'action_nameに於いて' do
+ before do
+ @attribute = @attributes['action_name']
+ end
+ it 'textタイプである' do
+ expect(@attribute.type).to eq 'text'
+ end
+ end
+ describe 'category_idに於いて' do
+ before do
+ @attribute = @attributes['category_id']
+ end
+ it 'numberタイプである' do
+ expect(@attribute.type).to eq 'number'
+ end
+ end
+ describe 'tに於いて' do
+ before do
+ @attribute = @attributes['t']
+ end
+ it 'numberタイプである' do
+ expect(@attribute.type).to eq 'number'
+ end
+ end
+ describe 'parent_idに於いて' do
+ before do
+ @attribute = @attributes['parent_id']
+ end
+ it 'numberタイプである' do
+ expect(@attribute.type).to eq 'number'
+ end
+ end
+ describe 'lftに於いて' do
+ before do
+ @attribute = @attributes['lft']
+ end
+ it 'numberタイプである' do
+ expect(@attribute.type).to eq 'number'
+ end
+ end
+ describe 'rgtに於いて' do
+ before do
+ @attribute = @attributes['rgt']
+ end
+ it 'numberタイプである' do
+ expect(@attribute.type).to eq 'number'
+ end
+ end
+ describe 'depthに於いて' do
+ before do
+ @attribute = @attributes['depth']
+ end
+ it 'numberタイプである' do
+ expect(@attribute.type).to eq 'number'
+ end
+ end
+ end
+
+ end
+
+end