1 # -*- encoding: utf-8 -*-
5 describe SpeechBalloon do
6 include ManifestsMacros
11 describe 'ペタナイズに於いて' do
12 it 'パネルの要素として利用されるエレメントである' do
13 expect(@model.ancestors.include?(Peta::Element)).to eq true
16 expect(@model.my_peta.parent_model_name).to eq 'panel'
18 describe 'ブーストに於いて' do
20 @boosts = @model.my_peta.boost
21 @boosts_names = ['speech_balloon_template']
23 it 'これらのブーストが定義されている' do
24 set_boosts? @boosts, @boosts_names
26 describe 'フキダシテンプレートに於いて' do
28 @mani = @boosts['speech_balloon_template']
31 expect(@mani.level).to eq 'post'
32 expect(@mani.template_name).to eq 'speech_balloon_template'
33 expect(@mani.column_name_for_template_module).to eq 'speech_balloon_template_module_name'
34 expect(@mani.settings_column_name).to eq 'speech_balloon_template_settings'
35 expect(@mani.foreign_key).to eq 'speech_balloon_template_id'
38 expect(@mani.item_name_for_extend_model).to eq 'speech_balloon'
39 expect(@mani.setter_method_name).to eq 'speech_balloon_extend='
40 expect(@mani.getter_method_name).to eq 'speech_balloon_extend'
41 expect(@mani.extend_model_class_name).to eq 'SpeechBalloon'
42 expect(@mani.extend_module_name).to eq 'SpeechBalloonModule'
49 describe 'コントローラに於いて' do
51 @controller = @model.my_controller
53 it 'コマ絵のためのコントローラである' do
54 expect(@model.item_name).to eq 'speech_balloon'
56 describe 'actionに於いて' do
58 @actions = @controller.actions
59 @actions_names = ['index', 'by_author', 'by_panel', 'by_speech_balloon_template', 'show',
60 'count', 'count_by_author', 'count_by_panel', 'count_by_speech_balloon_template',
63 it 'これらのアクションが定義されている' do
64 set_actions? @actions, @actions_names
66 describe 'baseに於いて' do
68 describe 'indexに於いて' do
70 @action = @actions['index']
72 it 'listタイプのアクションである' do
73 expect(@action.type).to eq 'list'
75 it 'マニフェストから設定を取り出している' do
76 # コマ絵の公開リストを返すように定義している
77 set_list_action? @action, 'speech_balloon', 'public'
80 describe 'by_authorに於いて' do
82 @action = @actions['by_author']
84 it 'listタイプのアクションである' do
85 expect(@action.type).to eq 'list'
87 it 'マニフェストから設定を取り出している' do
88 # コマ絵の作家フィルタリストを返すように定義している
89 set_list_action? @action, 'speech_balloon', 'by_author'
92 describe 'by_panelに於いて' do
94 @action = @actions['by_panel']
96 it 'listタイプのアクションである' do
97 expect(@action.type).to eq 'list'
99 it 'マニフェストから設定を取り出している' do
100 #コマ絵のコマフィルタリストを返すように定義している
101 set_list_action? @action, 'speech_balloon', 'by_panel'
104 describe 'by_speech_balloon_templateに於いて' do
106 @action = @actions['by_speech_balloon_template']
108 it 'listタイプのアクションである' do
109 expect(@action.type).to eq 'list'
111 it 'マニフェストから設定を取り出している' do
112 # コマ絵のフキダシテンプレートフィルタリストを返すように定義している
113 set_list_action? @action, 'speech_balloon', 'by_speech_balloon_template'
116 describe 'showに於いて' do
118 @action = @actions['show']
120 it 'showタイプのアクションである' do
121 expect(@action.type).to eq 'show'
124 describe 'countに於いて' do
126 @action = @actions['count']
128 it 'countタイプのアクションである' do
129 expect(@action.type).to eq 'count'
131 it 'マニフェストから設定を取り出している' do
132 #コマ絵の公開リストのカウントを返すように定義している
133 set_list_action? @action, 'speech_balloon', 'public'
136 describe 'count_by_authorに於いて' do
138 @action = @actions['count_by_author']
140 it 'countタイプのアクションである' do
141 expect(@action.type).to eq 'count'
143 it 'マニフェストから設定を取り出している' do
144 # コマ絵の作家フィルタリストのカウントを返すように定義している
145 set_list_action? @action, 'speech_balloon', 'by_author'
148 describe 'count_by_panelに於いて' do
150 @action = @actions['count_by_panel']
152 it 'countタイプのアクションである' do
153 expect(@action.type).to eq 'count'
155 it 'マニフェストから設定を取り出している' do
156 # コマ絵のコマフィルタリストのカウントを返すように定義している
157 set_list_action? @action, 'speech_balloon', 'by_panel'
160 describe 'count_by_speech_balloon_templateに於いて' do
162 @action = @actions['count_by_speech_balloon_template']
164 it 'countタイプのアクションである' do
165 expect(@action.type).to eq 'count'
167 it 'マニフェストから設定を取り出している' do
168 # コマ絵のフキダシテンプレートフィルタリストのカウントを返すように定義している
169 set_list_action? @action, 'speech_balloon', 'by_speech_balloon_template'
172 describe 'newに於いて' do
174 @action = @actions['new']
176 it 'newタイプのアクションである' do
177 expect(@action.type).to eq 'new'
180 expect(@action.item_name).to eq 'speech_balloon'
183 describe 'editに於いて' do
185 @action = @actions['edit']
187 it 'editタイプのアクションである' do
188 expect(@action.type).to eq 'edit'
191 expect(@action.item_name).to eq 'speech_balloon'
198 describe 'モデルに於いて' do
200 @my_manifest = @model.my_manifest
202 it 'サポート機能が動作している' do
203 expect(@my_manifest.model_name).to eq 'speech_balloon'
204 expect(@my_manifest.classify).to eq @model
205 expect(@my_manifest.table_name).to eq 'speech_balloons'
208 describe 'associationsに於いて' do
209 describe 'belongs_toに於いて' do
211 @belongs_to = @my_manifest.associations.belongs_to
212 @names = ['panel', 'speech_balloon_template']
214 it 'これらのモデルに所属している' do
215 set_associations? @belongs_to, @names
217 describe 'panelに於いて' do
219 @mani = @belongs_to['panel']
221 it 'マニフェストから設定を取り出している' do
222 # モデル名と外部キーが定義あるいはデフォルト値補充されている
223 expect(@mani.model_name).to eq 'panel'
224 expect(@mani.id_column).to eq 'panel_id'
226 it 'サポート機能が動作している' do
228 expect(@mani.model).to eq Panel
231 describe 'speech_balloon_templateに於いて' do
233 @mani = @belongs_to['speech_balloon_template']
235 it 'マニフェストから設定を取り出している' do
236 # モデル名と外部キーが定義あるいはデフォルト値補充されている
237 expect(@mani.model_name).to eq 'speech_balloon_template'
238 expect(@mani.id_column).to eq 'speech_balloon_template_id'
240 it 'サポート機能が動作している' do
242 expect(@mani.model).to eq SpeechBalloonTemplate
246 describe 'has_oneに於いて' do
248 @has_one = @model.my_manifest.associations.has_one
249 @names = ['balloon', 'speech']
251 it 'これらのモデルを所持している' do
252 set_associations? @has_one, @names
254 describe 'balloonに於いて' do
256 @mani = @has_one['balloon']
258 it 'マニフェストから設定を取り出している' do
259 # モデル名, 外部キーが定義あるいはデフォルト値補充されている
260 expect(@mani.model_name).to eq 'balloon'
261 expect(@mani.foreign_key).to eq 'speech_balloon_id'
263 it 'サポート機能が動作している' do
265 expect(@mani.model).to eq Balloon
268 describe 'speechに於いて' do
270 @mani = @has_one['speech']
272 it 'マニフェストから設定を取り出している' do
273 # モデル名, 外部キーが定義あるいはデフォルト値補充されている
274 expect(@mani.model_name).to eq 'speech'
275 expect(@mani.foreign_key).to eq 'speech_balloon_id'
277 it 'サポート機能が動作している' do
279 expect(@mani.model).to eq Speech
285 describe 'attributesに於いて' do
287 @attributes = @model.my_manifest.attributes
289 it 'これらのカラムを定義している' do
290 set_attributes? @attributes,
291 ['id', 'panel_id', 'speech_balloon_template_id', 'speech_balloon_template_module_name',
292 'caption', 'speech_balloon_template_settings', 'z', 't',
293 'created_at', 'updated_at']
295 describe 'panel_idに於いて' do
297 @attribute = @attributes['panel_id']
300 expect(@attribute.type).to eq 'number'
303 describe 'speech_balloon_template_idに於いて' do
305 @attribute = @attributes['speech_balloon_template_id']
308 expect(@attribute.type).to eq 'number'
311 describe 'speech_balloon_template_module_nameに於いて' do
313 @attribute = @attributes['speech_balloon_template_module_name']
316 expect(@attribute.type).to eq 'text'
319 describe 'captionに於いて' do
321 @attribute = @attributes['caption']
324 expect(@attribute.type).to eq 'text'
327 describe 'speech_balloon_template_settingsに於いて' do
329 @attribute = @attributes['speech_balloon_template_settings']
332 expect(@attribute.type).to eq 'text'
337 @attribute = @attributes['z']
340 expect(@attribute.type).to eq 'number'
345 @attribute = @attributes['t']
348 expect(@attribute.type).to eq 'number'