1 # -*- encoding: utf-8 -*-
5 describe SpeechBalloonTemplate do
8 @admin =FactoryGirl.create :admin
9 @user_yas = FactoryGirl.create :user_yas_with_owner
10 @user_rom = FactoryGirl.create :user_rom
11 @author_yas = @user_yas.author
13 @circle = FactoryGirl.create :speech_balloon_template_circle_with_system_picture
14 @plain = FactoryGirl.create :speech_balloon_template_plain_with_system_picture
15 @square = FactoryGirl.create :speech_balloon_template_square_with_system_picture
16 @test = FactoryGirl.create :speech_balloon_template_test_with_system_picture
19 describe '生成メソッドに於いて' do
25 describe 'enable_listに於いて' do
29 it '有効なテンプレートをリストで返している' do
30 expect(SpeechBalloonTemplate.enable_list).to_not be_empty
33 it 'テンプレートが無効ならリストは空になっている' do
34 allow_any_instance_of(SpeechBalloonTemplate).to receive(:enable?).and_return(false)
35 expect(SpeechBalloonTemplate.enable_list).to be_empty
39 allow(@circle).to receive(:enable?).and_return(false)
40 expect(SpeechBalloonTemplate.enable_list.size).to eq 3
45 describe 'enable?に於いて' do
49 it 'テンプレートのマニフェストが設定されていないときは偽を返す' do
50 allow(SpeechBalloonTemplate).to receive(:template_manifest).and_return(nil)
51 expect(@circle.enable?).to be false
54 it '有効なテンプレートであれば真を返す' do
55 expect(@circle.enable?).to be true
58 it '無効なテンプレートの時は偽を返す' do
59 expect(@test.enable?).to be false
63 describe 'template_moduleに於いて' do
67 it 'それぞれのモジュールを返している' do
68 expect(@circle.template_module).to eq CircleSpeechBalloon
69 expect(@square.template_module).to eq SquareSpeechBalloon
73 describe 'template_path_nameに於いて' do
77 it 'それぞれのパスネームを返している' do
78 expect(@circle.template_path_name).to eq 'circle_speech_balloon'
79 expect(@square.template_path_name).to eq 'square_speech_balloon'
85 describe LicenseGroup do
86 include TemplateMacros
88 @admin = FactoryGirl.create :admin
89 @user_yas = FactoryGirl.create :user_yas_with_owner
90 @user_rom = FactoryGirl.create :user_rom
91 @author_yas = @user_yas.author
93 @cc = FactoryGirl.create :license_group_cc
94 @pc = FactoryGirl.create :license_group_pc
95 @test = FactoryGirl.create :license_group_test
98 describe '生成メソッドに於いて' do
104 describe 'enable_listに於いて' do
108 it '有効なテンプレートをリストで返している' do
109 expect(LicenseGroup.enable_list).to_not be_empty
112 it 'テンプレートが無効ならリストは空になっている' do
113 allow_any_instance_of(LicenseGroup).to receive(:enable?).and_return(false)
114 expect(LicenseGroup.enable_list).to be_empty
118 expect(LicenseGroup.enable_list.size).to eq 2
123 describe 'enable?に於いて' do
127 it 'テンプレートのマニフェストが設定されていないときは偽を返す' do
128 allow(LicenseGroup).to receive(:template_manifest).and_return(nil)
129 expect(@cc.enable?).to be false
132 it '有効なテンプレートであれば真を返す' do
133 expect(@cc.enable?).to be true
136 it '無効なテンプレートの時は偽を返す' do
137 expect(@test.enable?).to be false
141 describe 'template_moduleに於いて' do
145 it 'それぞれのモジュールを返している' do
146 expect(@cc.template_module).to eq PettanrCreativeCommonsV30Licenses
147 expect(@pc.template_module).to eq PettanrPettanCommonsV01Licenses
151 describe 'template_path_nameに於いて' do
155 it 'それぞれのパスネームを返している' do
156 expect(@cc.template_path_name).to eq 'pettanr_creative_commons_v30_licenses'
157 expect(@pc.template_path_name).to eq 'pettanr_pettan_commons_v01_licenses'
163 describe WritingFormat do
164 include TemplateMacros
166 @admin = FactoryGirl.create :admin
167 @user_yas = FactoryGirl.create :user_yas_with_owner
168 @user_rom = FactoryGirl.create :user_rom
169 @author_yas = @user_yas.author
171 @test = FactoryGirl.create :writing_format_test_with_system_picture
172 @simple = FactoryGirl.create :writing_format_simple_format_with_system_picture
175 describe '生成メソッドに於いて' do
181 describe 'enable_listに於いて' do
185 it '有効なテンプレートをリストで返している' do
186 expect(WritingFormat.enable_list).to_not be_empty
189 it 'テンプレートが無効ならリストは空になっている' do
190 allow_any_instance_of(WritingFormat).to receive(:enable?).and_return(false)
191 expect(SpeechBalloonTemplate.enable_list).to be_empty
195 allow(@simple).to receive(:enable?).and_return(false)
196 expect(WritingFormat.enable_list.size).to eq 1
201 describe 'enable?に於いて' do
205 it 'テンプレートのマニフェストが設定されていないときは偽を返す' do
206 allow(WritingFormat).to receive(:template_manifest).and_return(nil)
207 expect(@simple.enable?).to be false
210 it '有効なテンプレートであれば真を返す' do
211 expect(@simple.enable?).to be true
214 it '無効なテンプレートの時は偽を返す' do
215 expect(@test.enable?).to be false
219 describe 'template_moduleに於いて' do
223 it 'それぞれのモジュールを返している' do
224 expect(@simple.template_module).to eq PettanrSimpleFormat
228 describe 'template_path_nameに於いて' do
232 it 'それぞれのパスネームを返している' do
233 expect(@simple.template_path_name).to eq 'pettanr_simple_format'