OSDN Git Service

fix:error dlg
[pettanr/pettanr.git] / spec / manifests / original_picture_license_spec.rb
1 # -*- encoding: utf-8 -*-
2 #原画ライセンス
3 require 'spec_helper'
4
5 describe OriginalPictureLicense do
6   include ManifestsMacros
7   before do
8     @model = OriginalPictureLicense
9   end
10   
11   describe 'ペタナイズに於いて' do
12     it 'アイテムである' do
13       expect(@model.ancestors.include?(Peta::Item)).to eq true
14     end
15     it '親モデルは持たない' do
16       expect(@model.my_peta.parent_model_name).to be_blank
17     end
18     describe 'ブーストに於いて' do
19       before do
20         @boosts = @model.my_peta.boost
21         @boosts_names = ['license']
22       end
23       it 'これらのブーストが定義されている' do
24         set_boosts? @boosts, @boosts_names
25       end
26       describe 'ライセンスに於いて' do
27         before do
28           @mani = @boosts['license']
29         end
30         it 'フキダシテンプレート' do
31           expect(@mani.level).to eq 'post'
32           expect(@mani.template_name).to eq 'license_group'
33           expect(@mani.column_name_for_template_module).to eq 'license_group_module_name'
34           expect(@mani.settings_column_name).to eq 'license_settings'
35           expect(@mani.foreign_key).to eq 'license_group_id'
36         end
37         it 'フキダシテンプレート' do
38           expect(@mani.item_name_for_extend_model).to eq 'attribute'
39           expect(@mani.setter_method_name).to eq 'attribute_extend='
40           expect(@mani.getter_method_name).to eq 'attribute_extend'
41           expect(@mani.extend_model_class_name).to eq 'Attribute'
42           expect(@mani.extend_module_name).to eq 'AttributeModule'
43         end
44       end
45     end
46     
47   end
48   
49   describe 'コントローラに於いて' do
50   end
51   
52   describe 'モデルに於いて' do
53     before do
54       @my_manifest = @model.my_manifest
55     end
56     it 'サポート機能が動作している' do
57       expect(@my_manifest.model_name).to eq 'original_picture_license'
58       expect(@my_manifest.classify).to eq @model
59       expect(@my_manifest.table_name).to eq 'original_picture_licenses'
60     end
61     
62     describe 'associationsに於いて' do
63       describe 'belongs_toに於いて' do
64         before do
65           @belongs_to = @my_manifest.associations.belongs_to
66           @names = ['original_picture', 'license', 'system_picture']
67         end
68         it 'これらのモデルに所属している' do
69           set_associations? @belongs_to, @names
70         end
71         describe 'original_pictureに於いて' do
72           before do
73             @mani = @belongs_to['original_picture']
74           end
75           it 'マニフェストから設定を取り出している' do
76             # モデル名と外部キーが定義あるいはデフォルト値補充されている
77             expect(@mani.model_name).to eq 'original_picture'
78             expect(@mani.id_column).to eq 'original_picture_id'
79           end
80           it 'サポート機能が動作している' do
81             # モデルを再現できている
82             expect(@mani.model).to eq OriginalPicture
83           end
84         end
85         describe 'licenseに於いて' do
86           before do
87             @mani = @belongs_to['license']
88           end
89           it 'マニフェストから設定を取り出している' do
90             # モデル名と外部キーが定義あるいはデフォルト値補充されている
91             expect(@mani.model_name).to eq 'license'
92             expect(@mani.id_column).to eq 'license_id'
93           end
94           it 'サポート機能が動作している' do
95             # モデルを再現できている
96             expect(@mani.model).to eq License
97           end
98         end
99         describe 'system_pictureに於いて' do
100           before do
101             @mani = @belongs_to['system_picture']
102           end
103           it 'マニフェストから設定を取り出している' do
104             # モデル名と外部キーが定義あるいはデフォルト値補充されている
105             expect(@mani.model_name).to eq 'system_picture'
106             expect(@mani.id_column).to eq 'system_picture_id'
107           end
108           it 'サポート機能が動作している' do
109             # モデルを再現できている
110             expect(@mani.model).to eq SystemPicture
111           end
112         end
113       end
114       describe 'has_manyに於いて' do
115         before do
116           @has_many = @model.my_manifest.associations.has_many
117           @names = []
118         end
119         it 'これらのモデルを所持している' do
120           set_associations? @has_many, @names
121         end
122       end
123     end
124     
125     describe 'attributesに於いて' do
126       before do
127         @attributes = @model.my_manifest.attributes
128       end
129       it 'これらのカラムを定義している' do
130         set_attributes? @attributes, 
131           ['id', 'original_picture_id', 'license_group_id', 'license_id', 
132           'license_settings', 'license_group_module_name', 
133           'created_at', 'updated_at']
134       end
135       describe 'original_picture_idに於いて' do
136         before do
137           @attribute = @attributes['original_picture_id']
138         end
139         it 'numberタイプである' do
140           expect(@attribute.type).to eq 'number'
141         end
142       end
143       describe 'license_group_idに於いて' do
144         before do
145           @attribute = @attributes['license_group_id']
146         end
147         it 'numberタイプである' do
148           expect(@attribute.type).to eq 'number'
149         end
150       end
151       describe 'license_idに於いて' do
152         before do
153           @attribute = @attributes['license_id']
154         end
155         it 'numberタイプである' do
156           expect(@attribute.type).to eq 'number'
157         end
158       end
159       describe 'license_settingsに於いて' do
160         before do
161           @attribute = @attributes['license_settings']
162         end
163         it 'textタイプである' do
164           expect(@attribute.type).to eq 'text'
165         end
166       end
167       describe 'license_group_module_nameに於いて' do
168         before do
169           @attribute = @attributes['license_group_module_name']
170         end
171         it 'textタイプである' do
172           expect(@attribute.type).to eq 'text'
173         end
174       end
175     end
176     
177   end
178   
179 end