--- /dev/null
+# -*- encoding: utf-8 -*-
+require 'spec_helper'
+#スト紙
+describe StorySheet do
+ include ManifestsMacros
+ before do
+ @model = StorySheet
+ end
+
+ describe 'ペタナイズに於いて' do
+ it 'スト紙に用紙を差し込むためのリーフである' do
+ expect(@model.ancestors.include?(Peta::Leaf)).to eq true
+ end
+ it '親モデルはストーリーである' do
+ expect(@model.my_peta.parent_model_name).to eq 'story'
+ 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 'story_sheet'
+ end
+ describe 'actionに於いて' do
+ before do
+ @actions = @controller.actions
+ @actions_names = ['index', 'by_author', 'by_story', 'by_sheet', 'show',
+ 'count', 'count_by_author', 'count_by_story', 'count_by_sheet',
+ 'new', 'edit', 'create', 'update', 'destroy']
+ end
+ it 'これらのアクションが定義されている' do
+ set_actions? @actions, @actions_names
+ end
+ describe 'baseに於いて' do
+ 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, 'story_sheet', 'public'
+ end
+ end
+ describe 'by_authorに於いて' do
+ before do
+ @action = @actions['by_author']
+ end
+ it 'listタイプのアクションである' do
+ expect(@action.type).to eq 'list'
+ end
+ it 'マニフェストから設定を取り出している' do
+ # スト紙の作家フィルタリストを返すように定義している
+ set_list_action? @action, 'story_sheet', 'by_author'
+ end
+ end
+ describe 'by_storyに於いて' do
+ before do
+ @action = @actions['by_story']
+ end
+ it 'listタイプのアクションである' do
+ expect(@action.type).to eq 'list'
+ end
+ it 'マニフェストから設定を取り出している' do
+ #スト紙のコマフィルタリストを返すように定義している
+ set_list_action? @action, 'story_sheet', 'by_story'
+ end
+ end
+ describe 'by_sheetに於いて' do
+ before do
+ @action = @actions['by_sheet']
+ end
+ it 'listタイプのアクションである' do
+ expect(@action.type).to eq 'list'
+ end
+ it 'マニフェストから設定を取り出している' do
+ #スト紙のコマフィルタリストを返すように定義している
+ set_list_action? @action, 'story_sheet', 'by_sheet'
+ 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, 'story_sheet', 'public'
+ end
+ end
+ describe 'count_by_authorに於いて' do
+ before do
+ @action = @actions['count_by_author']
+ end
+ it 'countタイプのアクションである' do
+ expect(@action.type).to eq 'count'
+ end
+ it 'マニフェストから設定を取り出している' do
+ # スト紙の作家フィルタリストのカウントを返すように定義している
+ set_list_action? @action, 'story_sheet', 'by_author'
+ end
+ end
+ describe 'count_by_storyに於いて' do
+ before do
+ @action = @actions['count_by_story']
+ end
+ it 'countタイプのアクションである' do
+ expect(@action.type).to eq 'count'
+ end
+ it 'マニフェストから設定を取り出している' do
+ # スト紙のコマフィルタリストのカウントを返すように定義している
+ set_list_action? @action, 'story_sheet', 'by_story'
+ end
+ end
+ describe 'count_by_sheetに於いて' do
+ before do
+ @action = @actions['count_by_sheet']
+ end
+ it 'countタイプのアクションである' do
+ expect(@action.type).to eq 'count'
+ end
+ it 'マニフェストから設定を取り出している' do
+ # スト紙のコマフィルタリストのカウントを返すように定義している
+ set_list_action? @action, 'story_sheet', 'by_sheet'
+ 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 'story_sheet'
+ 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 'story_sheet'
+ end
+ end
+ describe 'createに於いて' do
+ before do
+ @action = @actions['create']
+ end
+ it 'createタイプのアクションである' do
+ expect(@action.type).to eq 'create'
+ end
+ it 'type' do
+ expect(@action.item_name).to eq 'story_sheet'
+ end
+ end
+ describe 'updateに於いて' do
+ before do
+ @action = @actions['update']
+ end
+ it 'updateタイプのアクションである' do
+ expect(@action.type).to eq 'update'
+ end
+ it 'type' do
+ expect(@action.item_name).to eq 'story_sheet'
+ 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 'story_sheet'
+ end
+ end
+ end
+
+ end
+
+ describe 'モデルに於いて' do
+ before do
+ @my_manifest = @model.my_manifest
+ end
+ it 'サポート機能が動作している' do
+ expect(@my_manifest.model_name).to eq 'story_sheet'
+ expect(@my_manifest.classify).to eq @model
+ expect(@my_manifest.table_name).to eq 'story_sheets'
+ end
+
+ describe 'associationsに於いて' do
+ describe 'belongs_toに於いて' do
+ before do
+ @belongs_to = @my_manifest.associations.belongs_to
+ @names = ['story', 'sheet']
+ end
+ it 'これらのモデルに所属している' do
+ set_associations? @belongs_to, @names
+ end
+ describe 'storyに於いて' do
+ before do
+ @mani = @belongs_to['story']
+ end
+ it 'マニフェストから設定を取り出している' do
+ # モデル名と外部キーが定義あるいはデフォルト値補充されている
+ expect(@mani.model_name).to eq 'story'
+ expect(@mani.id_column).to eq 'story_id'
+ end
+ it 'サポート機能が動作している' do
+ # モデルを再現できている
+ expect(@mani.model).to eq Story
+ end
+ end
+ describe 'sheetに於いて' do
+ before do
+ @mani = @belongs_to['sheet']
+ end
+ it 'マニフェストから設定を取り出している' do
+ # モデル名と外部キーが定義あるいはデフォルト値補充されている
+ expect(@mani.model_name).to eq 'sheet'
+ expect(@mani.id_column).to eq 'sheet_id'
+ end
+ it 'サポート機能が動作している' do
+ # モデルを再現できている
+ expect(@mani.model).to eq Sheet
+ end
+ 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', 'story_id', 'sheet_id', 't',
+ 'created_at', 'updated_at']
+ end
+ describe 'story_idに於いて' do
+ before do
+ @attribute = @attributes['story_id']
+ end
+ it 'numberタイプである' do
+ expect(@attribute.type).to eq 'number'
+ end
+ end
+ describe 'sheet_idに於いて' do
+ before do
+ @attribute = @attributes['sheet_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
+ end
+
+ end
+
+end