1 # -*- encoding: utf-8 -*-
\r
7 @user = Factory( :user_yas)
9 @artist = Factory :artist_yas, :author_id => @author.id
\r
10 @license = Factory :license
12 @balloon = Factory :panel
13 @speech_balloon_template = Factory :speech_balloon_template
14 @speech_balloon = Factory :speech_balloon, :panel_id => @balloon.id, :speech_balloon_template_id => @speech_balloon_template.id
\r
15 @system_picture = Factory :system_picture
22 it 'オーソドックスなデータなら通る' do
23 @balloon = Factory.build :balloon, :speech_balloon_id => @speech_balloon.id, :system_picture_id => @system_picture.id
24 @balloon.should be_valid
27 context 'speech_balloon_idを検証するとき' do
29 @balloon = Factory.build :balloon, :speech_balloon_id => @speech_balloon.id, :system_picture_id => @system_picture.id
32 @balloon.speech_balloon_id = @speech_balloon.id
33 @balloon.should be_valid
36 @balloon.speech_balloon_id = nil
37 @balloon.should_not be_valid
40 @balloon.speech_balloon_id = 'a'
41 @balloon.should_not be_valid
43 it '存在するフキダシでなければ失敗する' do
44 @balloon.speech_balloon_id = 0
45 @balloon.should_not be_valid
48 context 'system_picture_idを検証するとき' do
50 @balloon = Factory.build :balloon, :speech_balloon_id => @speech_balloon.id, :system_picture_id => @system_picture.id
53 @balloon.system_picture_id = @system_picture.id
54 @balloon.should be_valid
57 @balloon.system_picture_id = nil
58 @balloon.should_not be_valid
61 @balloon.system_picture_id = 'a'
62 @balloon.should_not be_valid
64 it '存在するシステム画像でなければ失敗する' do
65 @balloon.system_picture_id = 0
66 @balloon.should_not be_valid
71 @balloon = Factory.build :balloon, :speech_balloon_id => @speech_balloon.id, :system_picture_id => @system_picture.id
75 @balloon.should be_valid
79 @balloon.should_not be_valid
83 @balloon.should_not be_valid
87 @balloon.should be_valid
91 @balloon.should be_valid
96 @balloon = Factory.build :balloon, :speech_balloon_id => @speech_balloon.id, :system_picture_id => @system_picture.id
100 @balloon.should be_valid
104 @balloon.should_not be_valid
108 @balloon.should_not be_valid
112 @balloon.should be_valid
116 @balloon.should be_valid
119 context 'widthを検証するとき' do
121 @balloon = Factory.build :balloon, :speech_balloon_id => @speech_balloon.id, :system_picture_id => @system_picture.id
125 @balloon.should be_valid
129 @balloon.should_not be_valid
133 @balloon.should_not be_valid
137 @balloon.should_not be_valid
141 @balloon.should_not be_valid
144 context 'heightを検証するとき' do
146 @balloon = Factory.build :balloon, :speech_balloon_id => @speech_balloon.id, :system_picture_id => @system_picture.id
149 @balloon.height = '1'
150 @balloon.should be_valid
153 @balloon.height = nil
154 @balloon.should_not be_valid
157 @balloon.height = 'a'
158 @balloon.should_not be_valid
161 @balloon.height = '0'
162 @balloon.should_not be_valid
166 @balloon.should_not be_valid
169 context 'settingsを検証するとき' do
171 @balloon = Factory.build :balloon, :speech_balloon_id => @speech_balloon.id, :system_picture_id => @system_picture.id
174 @balloon.settings = ''
175 @balloon.should be_valid
180 describe 'データ補充に於いて' do