1 # -*- encoding: utf-8 -*-
\r
2 require 'spec_helper'
\r
7 @license = Factory :license
\r
8 @user = Factory( :user_yas)
\r
9 @author = @user.author
\r
11 @panel = Factory :panel
\r
12 @speech_balloon_template = Factory :speech_balloon_template
\r
13 @speech_balloon = Factory :speech_balloon, :panel_id => @panel.id, :speech_balloon_template_id => @speech_balloon_template.id
\r
16 describe '検証に於いて' do
\r
17 it 'オーソドックスなデータなら通る' do
\r
18 @speech = Factory.build :speech, :speech_balloon_id => @speech_balloon.id
\r
19 @speech.should be_valid
\r
22 context 'speech_balloon_idを検証するとき' do
\r
24 @speech = Factory.build :speech, :speech_balloon_id => @speech_balloon.id
\r
27 @speech.speech_balloon_id = @speech_balloon.id
\r
28 @speech.should be_valid
\r
31 @speech.speech_balloon_id = 'a'
\r
32 @speech.should_not be_valid
\r
35 context 'contentを検証するとき' do
\r
37 context 'xを検証するとき' do
\r
39 @speech = Factory.build :speech, :speech_balloon_id => @speech_balloon.id
\r
43 @speech.should be_valid
\r
47 @speech.should_not be_valid
\r
51 @speech.should_not be_valid
\r
55 @speech.should be_valid
\r
59 @speech.should be_valid
\r
62 context 'yを検証するとき' do
\r
64 @speech = Factory.build :speech, :speech_balloon_id => @speech_balloon.id
\r
68 @speech.should be_valid
\r
72 @speech.should_not be_valid
\r
76 @speech.should_not be_valid
\r
80 @speech.should be_valid
\r
84 @speech.should be_valid
\r
87 context 'widthを検証するとき' do
\r
89 @speech = Factory.build :speech, :speech_balloon_id => @speech_balloon.id
\r
93 @speech.should be_valid
\r
97 @speech.should_not be_valid
\r
100 @speech.width = 'a'
\r
101 @speech.should_not be_valid
\r
104 @speech.width = '0'
\r
105 @speech.should_not be_valid
\r
109 @speech.should_not be_valid
\r
112 context 'heightを検証するとき' do
\r
114 @speech = Factory.build :speech, :speech_balloon_id => @speech_balloon.id
\r
117 @speech.height = '1'
\r
118 @speech.should be_valid
\r
121 @speech.height = nil
\r
122 @speech.should_not be_valid
\r
124 it '数値でなければ失敗する' do
\r
125 @speech.height = 'a'
\r
126 @speech.should_not be_valid
\r
129 @speech.height = '0'
\r
130 @speech.should_not be_valid
\r
133 @speech.height = -1
\r
134 @speech.should_not be_valid
\r
137 context 'settingsを検証するとき' do
\r
139 @speech = Factory.build :speech, :speech_balloon_id => @speech_balloon.id
\r
142 @speech.settings = ''
\r
143 @speech.should be_valid
\r