@license = Factory :license
@user = Factory( :user_yas)
@author = @user.author
- @artist = Factory :artist_yas, :author_id => @author.id\r
- @other_user = Factory( :user_yas)
- @other_author = @other_user.author
- @other_artist = Factory :artist_yas, :author_id => @other_author.id
+ @panel = Factory :panel
+ @speech_balloon_template = Factory :speech_balloon_template
+ @speech_balloon = Factory :speech_balloon, :panel_id => @panel.id, :speech_balloon_template_id => @speech_balloon_template.id\r
end\r
describe '検証に於いて' do
- before do
- @st = Factory :speech_template\r
- @comic = Factory :comic, :author_id => @author.id
- @panel = Factory :panel, :author_id => @author.id, :comic_id => @comic.id
- @balloon = Factory :balloon, :panel_id => @panel.id, :t => 0
- @speech = Factory.build :speech, :balloon => @balloon.id, :t => 0
- end
-
it 'オーソドックスなデータなら通る' do
+ @speech = Factory.build :speech, :speech_balloon_id => @speech_balloon.id
@speech.should be_valid
- end
+ end\r
- context 'balloon_idを検証するとき' do
+ context 'speech_balloon_idを検証するとき' do
before do
+ @speech = Factory.build :speech, :speech_balloon_id => @speech_balloon.id
end
it 'テストデータの確認' do
- @speech.comic_id = @comic.id
+ @speech.speech_balloon_id = @speech_balloon.id
@speech.should be_valid
end
it 'nullなら失敗する' do
- @speech.comic_id = nil
- @speech.should_not be_valid
- end
- it '数値でなければ失敗する' do
- @speech.comic_id = 'a'
- @speech.should_not be_valid
- end
- it '存在するコミックでなければ失敗する' do
- @speech.comic_id = 0
+ @speech.speech_balloon_id = nil
@speech.should_not be_valid
end
- it 'コミックidとtが重複していると失敗する' do
- @speech.save\r
- @speech2 = Factory.build :panel, :author_id => @author.id, :comic_id => @comic.id
- @speech2.should_not be_valid
- end
- end
- context 'resource_picture_idを検証するとき' do
- before do
- @speech = Factory.build :panel, :author_id => @author.id, :comic_id => @comic.id
- end
- it 'テストデータの確認' do
- @speech.resource_picture_id = 1
- @speech.should be_valid
- end
- it 'nullなら通る' do
- @speech.resource_picture_id = nil
- @speech.should be_valid
- end
it '数値でなければ失敗する' do
- @speech.resource_picture_id = 'a'
+ @speech.speech_balloon_id = 'a'
@speech.should_not be_valid
end
- it '存在する素材でなければ失敗する' do
- @speech.resource_picture_id = 0
+ it '存在するフキダシコミックでなければ失敗する' do
+ @speech.speech_balloon_id = 0
@speech.should_not be_valid
end
end
- context 'widthを検証するとき' do
- before do
- @speech = Factory.build :panel, :author_id => @author.id, :comic_id => @comic.id
- end
- it 'テストデータの確認' do
- @speech.width = 1
- @speech.should be_valid
- end
- it 'nullなら失敗する' do
- @speech.width = nil
- @speech.should_not be_valid
- end
- it '数値でなければ失敗する' do
- @speech.width = 'a'
- @speech.should_not be_valid
- end
- it '0なら失敗する' do
- @speech.width = '0'
- @speech.should_not be_valid
- end
- it '負でも失敗する' do
- @speech.width = -1
- @speech.should_not be_valid
- end
+ context 'contentを検証するとき' do
end
- context 'heightを検証するとき' do
- before do
- @speech = Factory.build :panel, :author_id => @author.id, :comic_id => @comic.id
- end
- it 'テストデータの確認' do
- @speech.height = '1'
- @speech.should be_valid
- end
- it 'nullなら失敗する' do
- @speech.height = nil
- @speech.should_not be_valid
- end
- it '数値でなければ失敗する' do
- @speech.height = 'a'
- @speech.should_not be_valid
- end
- it '0なら失敗する' do
- @speech.height = '0'
- @speech.should_not be_valid
- end
- it '負でも失敗する' do
- @speech.height = -1
- @speech.should_not be_valid
- end
- end
- context 'borderを検証するとき' do
+ context 'xを検証するとき' do
before do
- @speech = Factory.build :panel, :author_id => @author.id, :comic_id => @comic.id
+ @speech = Factory.build :speech, :speech_balloon_id => @speech_balloon.id
end
it 'テストデータの確認' do
- @speech.border = '1'
+ @speech.x = '1'
@speech.should be_valid
end
it 'nullなら失敗する' do
- @speech.border = nil
+ @speech.x = nil
@speech.should_not be_valid
end
it '数値でなければ失敗する' do
- @speech.border = 'a'
- @speech.should_not be_valid
- end
- it '負なら失敗する' do
- @speech.border = '-1'
- @speech.should_not be_valid
- end
- it '0なら通る' do
- @speech.border = 0
- @speech.should be_valid
- end
- end
- context 'xを検証するとき' do
- before do
- @speech = Factory.build :panel, :author_id => @author.id, :comic_id => @comic.id
- end
- it 'テストデータの確認' do
- @speech.x = '1'
- @speech.should be_valid
- end
- it '数値でなければ失敗する' do
@speech.x = 'a'
@speech.should_not be_valid
end
end
context 'yを検証するとき' do
before do
- @speech = Factory.build :panel, :author_id => @author.id, :comic_id => @comic.id
+ @speech = Factory.build :speech, :speech_balloon_id => @speech_balloon.id
end
it 'テストデータの確認' do
@speech.y = '1'
@speech.should be_valid
end
+ it 'nullなら失敗する' do
+ @speech.y = nil
+ @speech.should_not be_valid
+ end
it '数値でなければ失敗する' do
@speech.y = 'a'
@speech.should_not be_valid
@speech.should be_valid
end
end
- context 'zを検証するとき' do
+ context 'widthを検証するとき' do
before do
- @speech = Factory.build :panel, :author_id => @author.id, :comic_id => @comic.id
+ @speech = Factory.build :speech, :speech_balloon_id => @speech_balloon.id
end
it 'テストデータの確認' do
- @speech.z = '1'
+ @speech.width = 1
@speech.should be_valid
end
+ it 'nullなら失敗する' do
+ @speech.width = nil
+ @speech.should_not be_valid
+ end
it '数値でなければ失敗する' do
- @speech.z = 'a'
+ @speech.width = 'a'
@speech.should_not be_valid
end
it '0なら失敗する' do
- @speech.z = '0'
+ @speech.width = '0'
@speech.should_not be_valid
end
- it 'è² ã\81ªã\82\89失敗する' do
- @speech.z = -1
+ it 'è² ã\81§ã\82\82失敗する' do
+ @speech.width = -1
@speech.should_not be_valid
end
end
- context 'tを検証するとき' do
+ context 'heightを検証するとき' do
before do
- @speech = Factory.build :panel, :author_id => @author.id, :comic_id => @comic.id
+ @speech = Factory.build :speech, :speech_balloon_id => @speech_balloon.id
end
it 'テストデータの確認' do
- @speech.t = '1'
+ @speech.height = '1'
@speech.should be_valid
end
+ it 'nullなら失敗する' do
+ @speech.height = nil
+ @speech.should_not be_valid
+ end
it '数値でなければ失敗する' do
- @speech.t = 'a'
+ @speech.height = 'a'
@speech.should_not be_valid
end
- it '0なら通る' do
- @speech.t = '0'
- @speech.should be_valid
+ it '0なら失敗する' do
+ @speech.height = '0'
+ @speech.should_not be_valid
end
it '負でも失敗する' do
- @speech.t = -1
+ @speech.height = -1
@speech.should_not be_valid
end
end
- context 'author_idを検証するとき' do
+ context 'settingsを検証するとき' do
before do
- @speech = Factory.build :panel, :author_id => @author.id, :comic_id => @comic.id
+ @speech = Factory.build :speech, :speech_balloon_id => @speech_balloon.id
end
it 'テストデータの確認' do
- @speech.author_id = @author.id
+ @speech.settings = ''
@speech.should be_valid
end
- it 'nullなら失敗する' do
- @speech.author_id = nil
- @speech.should_not be_valid
- end
- it '数値でなければ失敗する' do
- @speech.author_id = 'a'
- @speech.should_not be_valid
- end
- it '存在する絵師でなければ失敗する' do
- @speech.author_id = 0
- @speech.should_not be_valid
- end
- end
- context '全体を検証するとき' do
- before do
- @speech = Factory :panel, :author_id => @author.id, :comic_id => @comic.id
- end
end
end