1 # -*- encoding: utf-8 -*-
5 describe OriginalPictureLicense do
6 include ManifestsMacros
8 @model = OriginalPictureLicense
11 describe 'ペタナイズに於いて' do
13 expect(@model.ancestors.include?(Peta::Item)).to eq true
16 expect(@model.my_peta.parent_model_name).to be_blank
18 describe 'ブーストに於いて' do
20 @boosts = @model.my_peta.boost
21 @boosts_names = ['license']
23 it 'これらのブーストが定義されている' do
24 set_boosts? @boosts, @boosts_names
26 describe 'ライセンスに於いて' do
28 @mani = @boosts['license']
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'
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'
49 describe 'コントローラに於いて' do
54 @my_manifest = @model.my_manifest
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'
62 describe 'associationsに於いて' do
63 describe 'belongs_toに於いて' do
65 @belongs_to = @my_manifest.associations.belongs_to
66 @names = ['original_picture', 'license', 'system_picture']
68 it 'これらのモデルに所属している' do
69 set_associations? @belongs_to, @names
71 describe 'original_pictureに於いて' do
73 @mani = @belongs_to['original_picture']
75 it 'マニフェストから設定を取り出している' do
76 # モデル名と外部キーが定義あるいはデフォルト値補充されている
77 expect(@mani.model_name).to eq 'original_picture'
78 expect(@mani.id_column).to eq 'original_picture_id'
82 expect(@mani.model).to eq OriginalPicture
85 describe 'licenseに於いて' do
87 @mani = @belongs_to['license']
89 it 'マニフェストから設定を取り出している' do
90 # モデル名と外部キーが定義あるいはデフォルト値補充されている
91 expect(@mani.model_name).to eq 'license'
92 expect(@mani.id_column).to eq 'license_id'
96 expect(@mani.model).to eq License
99 describe 'system_pictureに於いて' do
101 @mani = @belongs_to['system_picture']
103 it 'マニフェストから設定を取り出している' do
104 # モデル名と外部キーが定義あるいはデフォルト値補充されている
105 expect(@mani.model_name).to eq 'system_picture'
106 expect(@mani.id_column).to eq 'system_picture_id'
108 it 'サポート機能が動作している' do
110 expect(@mani.model).to eq SystemPicture
114 describe 'has_manyに於いて' do
116 @has_many = @model.my_manifest.associations.has_many
119 it 'これらのモデルを所持している' do
120 set_associations? @has_many, @names
125 describe 'attributesに於いて' do
127 @attributes = @model.my_manifest.attributes
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']
135 describe 'original_picture_idに於いて' do
137 @attribute = @attributes['original_picture_id']
140 expect(@attribute.type).to eq 'number'
143 describe 'license_group_idに於いて' do
145 @attribute = @attributes['license_group_id']
148 expect(@attribute.type).to eq 'number'
151 describe 'license_idに於いて' do
153 @attribute = @attributes['license_id']
156 expect(@attribute.type).to eq 'number'
159 describe 'license_settingsに於いて' do
161 @attribute = @attributes['license_settings']
164 expect(@attribute.type).to eq 'text'
167 describe 'license_group_module_nameに於いて' do
169 @attribute = @attributes['license_group_module_name']
172 expect(@attribute.type).to eq 'text'