1 # -*- encoding: utf-8 -*-
5 include ManifestsMacros
10 describe 'ペタナイズに於いて' do
11 it 'スト紙に用紙を差し込むためのリーフである' do
12 expect(@model.ancestors.include?(Peta::Leaf)).to eq true
15 expect(@model.my_peta.parent_model_name).to eq 'story'
17 describe 'ブーストに於いて' do
19 expect(@model.my_peta.boost.keys).to be_empty
25 describe 'コントローラに於いて' do
27 @controller = @model.my_controller
29 it 'スト紙のためのコントローラである' do
30 expect(@model.item_name).to eq 'story_sheet'
32 describe 'actionに於いて' do
34 @actions = @controller.actions
35 @actions_names = ['index', 'by_author', 'by_story', 'by_sheet', 'show',
36 'count', 'count_by_author', 'count_by_story', 'count_by_sheet',
37 'new', 'edit', 'create', 'update', 'destroy']
39 it 'これらのアクションが定義されている' do
40 set_actions? @actions, @actions_names
42 describe 'baseに於いて' do
44 describe 'indexに於いて' do
46 @action = @actions['index']
48 it 'listタイプのアクションである' do
49 expect(@action.type).to eq 'list'
51 it 'マニフェストから設定を取り出している' do
52 # スト紙の公開リストを返すように定義している
53 set_list_action? @action, 'story_sheet', 'public'
56 describe 'by_authorに於いて' do
58 @action = @actions['by_author']
60 it 'listタイプのアクションである' do
61 expect(@action.type).to eq 'list'
63 it 'マニフェストから設定を取り出している' do
64 # スト紙の作家フィルタリストを返すように定義している
65 set_list_action? @action, 'story_sheet', 'by_author'
68 describe 'by_storyに於いて' do
70 @action = @actions['by_story']
72 it 'listタイプのアクションである' do
73 expect(@action.type).to eq 'list'
75 it 'マニフェストから設定を取り出している' do
76 #スト紙のコマフィルタリストを返すように定義している
77 set_list_action? @action, 'story_sheet', 'by_story'
80 describe 'by_sheetに於いて' do
82 @action = @actions['by_sheet']
84 it 'listタイプのアクションである' do
85 expect(@action.type).to eq 'list'
87 it 'マニフェストから設定を取り出している' do
88 #スト紙のコマフィルタリストを返すように定義している
89 set_list_action? @action, 'story_sheet', 'by_sheet'
92 describe 'showに於いて' do
94 @action = @actions['show']
96 it 'showタイプのアクションである' do
97 expect(@action.type).to eq 'show'
100 describe 'countに於いて' do
102 @action = @actions['count']
104 it 'countタイプのアクションである' do
105 expect(@action.type).to eq 'count'
107 it 'マニフェストから設定を取り出している' do
108 #スト紙の公開リストのカウントを返すように定義している
109 set_list_action? @action, 'story_sheet', 'public'
112 describe 'count_by_authorに於いて' do
114 @action = @actions['count_by_author']
116 it 'countタイプのアクションである' do
117 expect(@action.type).to eq 'count'
119 it 'マニフェストから設定を取り出している' do
120 # スト紙の作家フィルタリストのカウントを返すように定義している
121 set_list_action? @action, 'story_sheet', 'by_author'
124 describe 'count_by_storyに於いて' do
126 @action = @actions['count_by_story']
128 it 'countタイプのアクションである' do
129 expect(@action.type).to eq 'count'
131 it 'マニフェストから設定を取り出している' do
132 # スト紙のコマフィルタリストのカウントを返すように定義している
133 set_list_action? @action, 'story_sheet', 'by_story'
136 describe 'count_by_sheetに於いて' do
138 @action = @actions['count_by_sheet']
140 it 'countタイプのアクションである' do
141 expect(@action.type).to eq 'count'
143 it 'マニフェストから設定を取り出している' do
144 # スト紙のコマフィルタリストのカウントを返すように定義している
145 set_list_action? @action, 'story_sheet', 'by_sheet'
148 describe 'newに於いて' do
150 @action = @actions['new']
152 it 'newタイプのアクションである' do
153 expect(@action.type).to eq 'new'
156 expect(@action.item_name).to eq 'story_sheet'
159 describe 'editに於いて' do
161 @action = @actions['edit']
163 it 'editタイプのアクションである' do
164 expect(@action.type).to eq 'edit'
167 expect(@action.item_name).to eq 'story_sheet'
170 describe 'createに於いて' do
172 @action = @actions['create']
174 it 'createタイプのアクションである' do
175 expect(@action.type).to eq 'create'
178 expect(@action.item_name).to eq 'story_sheet'
181 describe 'updateに於いて' do
183 @action = @actions['update']
185 it 'updateタイプのアクションである' do
186 expect(@action.type).to eq 'update'
189 expect(@action.item_name).to eq 'story_sheet'
192 describe 'destroyに於いて' do
194 @action = @actions['destroy']
196 it 'destroyタイプのアクションである' do
197 expect(@action.type).to eq 'destroy'
200 expect(@action.item_name).to eq 'story_sheet'
207 describe 'モデルに於いて' do
209 @my_manifest = @model.my_manifest
211 it 'サポート機能が動作している' do
212 expect(@my_manifest.model_name).to eq 'story_sheet'
213 expect(@my_manifest.classify).to eq @model
214 expect(@my_manifest.table_name).to eq 'story_sheets'
217 describe 'associationsに於いて' do
218 describe 'belongs_toに於いて' do
220 @belongs_to = @my_manifest.associations.belongs_to
221 @names = ['story', 'sheet']
223 it 'これらのモデルに所属している' do
224 set_associations? @belongs_to, @names
226 describe 'storyに於いて' do
228 @mani = @belongs_to['story']
230 it 'マニフェストから設定を取り出している' do
231 # モデル名と外部キーが定義あるいはデフォルト値補充されている
232 expect(@mani.model_name).to eq 'story'
233 expect(@mani.id_column).to eq 'story_id'
235 it 'サポート機能が動作している' do
237 expect(@mani.model).to eq Story
240 describe 'sheetに於いて' do
242 @mani = @belongs_to['sheet']
244 it 'マニフェストから設定を取り出している' do
245 # モデル名と外部キーが定義あるいはデフォルト値補充されている
246 expect(@mani.model_name).to eq 'sheet'
247 expect(@mani.id_column).to eq 'sheet_id'
249 it 'サポート機能が動作している' do
251 expect(@mani.model).to eq Sheet
255 describe 'has_manyに於いて' do
257 @has_many = @model.my_manifest.associations.has_many
260 it 'これらのモデルを所持している' do
261 set_associations? @has_many, @names
266 describe 'attributesに於いて' do
268 @attributes = @model.my_manifest.attributes
270 it 'これらのカラムを定義している' do
271 set_attributes? @attributes,
272 ['id', 'story_id', 'sheet_id', 't',
273 'created_at', 'updated_at']
275 describe 'story_idに於いて' do
277 @attribute = @attributes['story_id']
280 expect(@attribute.type).to eq 'number'
283 describe 'sheet_idに於いて' do
285 @attribute = @attributes['sheet_id']
288 expect(@attribute.type).to eq 'number'
293 @attribute = @attributes['t']
296 expect(@attribute.type).to eq 'number'