1 # -*- encoding: utf-8 -*-
\r
2 require 'spec_helper'
\r
5 include ManifestsMacros
\r
10 describe 'ペタナイズに於いて' do
\r
11 it 'フキダシの要素として利用されるエレメントである' do
\r
12 expect(@model.ancestors.include?(Peta::Element)).to eq true
\r
14 it '親モデルはフキダシである' do
\r
15 expect(@model.my_peta.parent_model_name).to eq 'speech_balloon'
\r
17 describe 'ブーストに於いて' do
\r
19 @boosts = @model.my_peta.boost
\r
20 @boosts_names = ['speech_balloon_template']
\r
22 it 'これらのブーストが定義されている' do
\r
23 set_boosts? @boosts, @boosts_names
\r
25 describe 'フキダシテンプレートに於いて' do
\r
27 @mani = @boosts['speech_balloon_template']
\r
29 it 'システム起動前に初期化可能なサポート機能が動作している' do
\r
30 expect(@mani.level).to eq 'post'
\r
31 expect(@mani.template_name).to eq 'speech_balloon_template'
\r
32 expect(@mani.column_name_for_template_module).to eq 'speech_balloon_template_module_name'
\r
33 expect(@mani.settings_column_name).to eq 'speech_balloon_template_settings'
\r
34 expect(@mani.foreign_key).to eq 'speech_balloon_template_id'
\r
36 it 'システム起動後にしか初期化できないサポート機能が動作している' do
\r
37 expect(@mani.item_name_for_extend_model).to eq 'balloon'
\r
38 expect(@mani.setter_method_name).to eq 'balloon_extend='
\r
39 expect(@mani.getter_method_name).to eq 'balloon_extend'
\r
40 expect(@mani.extend_model_class_name).to eq 'Balloon'
\r
41 expect(@mani.extend_module_name).to eq 'BalloonModule'
\r
48 describe 'コントローラに於いて' do
\r
50 @controller = @model.my_controller
\r
52 it 'フキダシ枠のためのコントローラである' do
\r
53 expect(@model.item_name).to eq 'balloon'
\r
55 describe 'actionに於いて' do
\r
57 @actions = @controller.actions
\r
58 @actions_names = ['index', 'by_author', 'show',
\r
59 'count', 'count_by_author',
\r
62 it 'これらのアクションが定義されている' do
\r
63 set_actions? @actions, @actions_names
\r
65 describe 'baseに於いて' do
\r
67 describe 'indexに於いて' do
\r
69 @action = @actions['index']
\r
71 it 'listタイプのアクションである' do
\r
72 expect(@action.type).to eq 'list'
\r
74 it 'マニフェストから設定を取り出している' do
\r
75 # フキダシ枠の公開リストを返すように定義している
\r
76 set_list_action? @action, 'balloon', 'public'
\r
79 describe 'by_authorに於いて' do
\r
81 @action = @actions['by_author']
\r
83 it 'listタイプのアクションである' do
\r
84 expect(@action.type).to eq 'list'
\r
86 it 'マニフェストから設定を取り出している' do
\r
87 # フキダシ枠の作家フィルタリストを返すように定義している
\r
88 set_list_action? @action, 'balloon', 'by_author'
\r
91 describe 'countに於いて' do
\r
93 @action = @actions['count']
\r
95 it 'countタイプのアクションである' do
\r
96 expect(@action.type).to eq 'count'
\r
98 it 'マニフェストから設定を取り出している' do
\r
99 #フキダシ枠の公開リストのカウントを返すように定義している
\r
100 set_list_action? @action, 'balloon', 'public'
\r
103 describe 'count_by_authorに於いて' do
\r
105 @action = @actions['count_by_author']
\r
107 it 'countタイプのアクションである' do
\r
108 expect(@action.type).to eq 'count'
\r
110 it 'マニフェストから設定を取り出している' do
\r
111 # フキダシ枠の作家フィルタリストのカウントを返すように定義している
\r
112 set_list_action? @action, 'balloon', 'by_author'
\r
115 describe 'newに於いて' do
\r
117 @action = @actions['new']
\r
119 it 'newタイプのアクションである' do
\r
120 expect(@action.type).to eq 'new'
\r
123 expect(@action.item_name).to eq 'balloon'
\r
126 describe 'editに於いて' do
\r
128 @action = @actions['edit']
\r
130 it 'editタイプのアクションである' do
\r
131 expect(@action.type).to eq 'edit'
\r
134 expect(@action.item_name).to eq 'balloon'
\r
141 describe 'モデルに於いて' do
\r
143 @my_manifest = @model.my_manifest
\r
145 it 'サポート機能が動作している' do
\r
146 expect(@my_manifest.model_name).to eq 'balloon'
\r
147 expect(@my_manifest.classify).to eq @model
\r
148 expect(@my_manifest.table_name).to eq 'balloons'
\r
151 describe 'associationsに於いて' do
\r
152 describe 'belongs_toに於いて' do
\r
154 @belongs_to = @my_manifest.associations.belongs_to
\r
155 @names = ['speech_balloon', 'system_picture', 'speech_balloon_template']
\r
157 it 'これらのモデルに所属している' do
\r
158 set_associations? @belongs_to, @names
\r
160 describe 'speech_balloonに於いて' do
\r
162 @mani = @belongs_to['speech_balloon']
\r
164 it 'マニフェストから設定を取り出している' do
\r
165 # モデル名と外部キーが定義あるいはデフォルト値補充されている
\r
166 expect(@mani.model_name).to eq 'speech_balloon'
\r
167 expect(@mani.id_column).to eq 'speech_balloon_id'
\r
169 it 'サポート機能が動作している' do
\r
171 expect(@mani.model).to eq SpeechBalloon
\r
174 describe 'system_pictureに於いて' do
\r
176 @mani = @belongs_to['system_picture']
\r
178 it 'マニフェストから設定を取り出している' do
\r
179 # モデル名と外部キーが定義あるいはデフォルト値補充されている
\r
180 expect(@mani.model_name).to eq 'system_picture'
\r
181 expect(@mani.id_column).to eq 'system_picture_id'
\r
183 it 'サポート機能が動作している' do
\r
185 expect(@mani.model).to eq SystemPicture
\r
188 describe 'speech_balloon_templateに於いて' do
\r
190 @mani = @belongs_to['speech_balloon_template']
\r
192 it 'マニフェストから設定を取り出している' do
\r
193 # モデル名と外部キーが定義あるいはデフォルト値補充されている
\r
194 expect(@mani.model_name).to eq 'speech_balloon_template'
\r
195 expect(@mani.id_column).to eq 'speech_balloon_template_id'
\r
197 it 'サポート機能が動作している' do
\r
199 expect(@mani.model).to eq SpeechBalloonTemplate
\r
203 describe 'has_manyに於いて' do
\r
205 @has_many = @model.my_manifest.associations.has_many
\r
208 it 'これらのモデルを所持している' do
\r
209 set_associations? @has_many, @names
\r
214 describe 'attributesに於いて' do
\r
216 @attributes = @model.my_manifest.attributes
\r
218 it 'これらのカラムを定義している' do
\r
219 set_attributes? @attributes,
\r
220 ['id', 'speech_balloon_id', 'speech_balloon_template_id', 'speech_balloon_template_module_name',
\r
221 'system_picture_id', 'x', 'y', 'width', 'height', 'r',
\r
222 'speech_balloon_template_settings',
\r
223 'created_at', 'updated_at']
\r
225 describe 'speech_balloon_idに於いて' do
\r
227 @attribute = @attributes['speech_balloon_id']
\r
229 it 'numberタイプである' do
\r
230 expect(@attribute.type).to eq 'number'
\r
233 describe 'speech_balloon_template_idに於いて' do
\r
235 @attribute = @attributes['speech_balloon_template_id']
\r
237 it 'numberタイプである' do
\r
238 expect(@attribute.type).to eq 'number'
\r
241 describe 'speech_balloon_template_module_nameに於いて' do
\r
243 @attribute = @attributes['speech_balloon_template_module_name']
\r
246 expect(@attribute.type).to eq 'text'
\r
249 describe 'system_picture_idに於いて' do
\r
251 @attribute = @attributes['system_picture_id']
\r
253 it 'numberタイプである' do
\r
254 expect(@attribute.type).to eq 'number'
\r
257 describe 'xに於いて' do
\r
259 @attribute = @attributes['x']
\r
261 it 'numberタイプである' do
\r
262 expect(@attribute.type).to eq 'number'
\r
265 describe 'yに於いて' do
\r
267 @attribute = @attributes['y']
\r
269 it 'numberタイプである' do
\r
270 expect(@attribute.type).to eq 'number'
\r
273 describe 'widthに於いて' do
\r
275 @attribute = @attributes['width']
\r
277 it 'numberタイプである' do
\r
278 expect(@attribute.type).to eq 'number'
\r
281 describe 'heightに於いて' do
\r
283 @attribute = @attributes['height']
\r
285 it 'numberタイプである' do
\r
286 expect(@attribute.type).to eq 'number'
\r
289 describe 'rに於いて' do
\r
291 @attribute = @attributes['r']
\r
293 it 'numberタイプである' do
\r
294 expect(@attribute.type).to eq 'number'
\r
297 describe 'speech_balloon_template_settingsに於いて' do
\r
299 @attribute = @attributes['speech_balloon_template_settings']
\r
302 expect(@attribute.type).to eq 'text'
\r