OSDN Git Service

Merge branch 'v03_test' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v03_test
[pettanr/pettanr.git] / spec / models / speech_spec.rb
similarity index 53%
rename from spec/models/speach_spec.rb
rename to spec/models/speech_spec.rb
index 660be6d..1f34f00 100644 (file)
@@ -1,7 +1,7 @@
 # -*- encoding: utf-8 -*-\r
 require 'spec_helper'
 
-describe Speach do
+describe Speech do
   before do
     Factory :admin
     @license = Factory :license
@@ -16,246 +16,246 @@ describe Speach do
   
   describe '検証に於いて' do
     before do
-      @st = Factory :speach_template\r
+      @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
-      @speach = Factory.build :speach, :balloon => @balloon.id, :t => 0
+      @speech = Factory.build :speech, :balloon => @balloon.id, :t => 0
     end
     
     it 'オーソドックスなデータなら通る' do
-      @speach.should be_valid
+      @speech.should be_valid
     end
     
     context 'balloon_idを検証するとき' do
       before do
       end
       it 'テストデータの確認' do
-        @speach.comic_id = @comic.id
-        @speach.should be_valid
+        @speech.comic_id = @comic.id
+        @speech.should be_valid
       end
       it 'nullなら失敗する' do
-        @speach.comic_id = nil
-        @speach.should_not be_valid
+        @speech.comic_id = nil
+        @speech.should_not be_valid
       end
       it '数値でなければ失敗する' do
-        @speach.comic_id = 'a'
-        @speach.should_not be_valid
+        @speech.comic_id = 'a'
+        @speech.should_not be_valid
       end
       it '存在するコミックでなければ失敗する' do
-        @speach.comic_id = 0
-        @speach.should_not be_valid
+        @speech.comic_id = 0
+        @speech.should_not be_valid
       end
       it 'コミックidとtが重複していると失敗する' do
-        @speach.save\r
-        @speach2 = Factory.build :panel, :author_id => @author.id, :comic_id => @comic.id
-        @speach2.should_not be_valid
+        @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
-        @speach = Factory.build :panel, :author_id => @author.id, :comic_id => @comic.id
+        @speech = Factory.build :panel, :author_id => @author.id, :comic_id => @comic.id
       end
       it 'テストデータの確認' do
-        @speach.resource_picture_id = 1
-        @speach.should be_valid
+        @speech.resource_picture_id = 1
+        @speech.should be_valid
       end
       it 'nullなら通る' do
-        @speach.resource_picture_id = nil
-        @speach.should be_valid
+        @speech.resource_picture_id = nil
+        @speech.should be_valid
       end
       it '数値でなければ失敗する' do
-        @speach.resource_picture_id = 'a'
-        @speach.should_not be_valid
+        @speech.resource_picture_id = 'a'
+        @speech.should_not be_valid
       end
       it '存在する素材でなければ失敗する' do
-        @speach.resource_picture_id = 0
-        @speach.should_not be_valid
+        @speech.resource_picture_id = 0
+        @speech.should_not be_valid
       end
     end
     context 'widthを検証するとき' do
       before do
-        @speach = Factory.build :panel, :author_id => @author.id, :comic_id => @comic.id
+        @speech = Factory.build :panel, :author_id => @author.id, :comic_id => @comic.id
       end
       it 'テストデータの確認' do
-        @speach.width = 1
-        @speach.should be_valid
+        @speech.width = 1
+        @speech.should be_valid
       end
       it 'nullなら失敗する' do
-        @speach.width = nil
-        @speach.should_not be_valid
+        @speech.width = nil
+        @speech.should_not be_valid
       end
       it '数値でなければ失敗する' do
-        @speach.width = 'a'
-        @speach.should_not be_valid
+        @speech.width = 'a'
+        @speech.should_not be_valid
       end
       it '0なら失敗する' do
-        @speach.width = '0'
-        @speach.should_not be_valid
+        @speech.width = '0'
+        @speech.should_not be_valid
       end
       it '負でも失敗する' do
-        @speach.width = -1
-        @speach.should_not be_valid
+        @speech.width = -1
+        @speech.should_not be_valid
       end
     end
     context 'heightを検証するとき' do
       before do
-        @speach = Factory.build :panel, :author_id => @author.id, :comic_id => @comic.id
+        @speech = Factory.build :panel, :author_id => @author.id, :comic_id => @comic.id
       end
       it 'テストデータの確認' do
-        @speach.height = '1'
-        @speach.should be_valid
+        @speech.height = '1'
+        @speech.should be_valid
       end
       it 'nullなら失敗する' do
-        @speach.height = nil
-        @speach.should_not be_valid
+        @speech.height = nil
+        @speech.should_not be_valid
       end
       it '数値でなければ失敗する' do
-        @speach.height = 'a'
-        @speach.should_not be_valid
+        @speech.height = 'a'
+        @speech.should_not be_valid
       end
       it '0なら失敗する' do
-        @speach.height = '0'
-        @speach.should_not be_valid
+        @speech.height = '0'
+        @speech.should_not be_valid
       end
       it '負でも失敗する' do
-        @speach.height = -1
-        @speach.should_not be_valid
+        @speech.height = -1
+        @speech.should_not be_valid
       end
     end
     context 'borderを検証するとき' do
       before do
-        @speach = Factory.build :panel, :author_id => @author.id, :comic_id => @comic.id
+        @speech = Factory.build :panel, :author_id => @author.id, :comic_id => @comic.id
       end
       it 'テストデータの確認' do
-        @speach.border = '1'
-        @speach.should be_valid
+        @speech.border = '1'
+        @speech.should be_valid
       end
       it 'nullなら失敗する' do
-        @speach.border = nil
-        @speach.should_not be_valid
+        @speech.border = nil
+        @speech.should_not be_valid
       end
       it '数値でなければ失敗する' do
-        @speach.border = 'a'
-        @speach.should_not be_valid
+        @speech.border = 'a'
+        @speech.should_not be_valid
       end
       it '負なら失敗する' do
-        @speach.border = '-1'
-        @speach.should_not be_valid
+        @speech.border = '-1'
+        @speech.should_not be_valid
       end
       it '0なら通る' do
-        @speach.border = 0
-        @speach.should be_valid
+        @speech.border = 0
+        @speech.should be_valid
       end
     end
     context 'xを検証するとき' do
       before do
-        @speach = Factory.build :panel, :author_id => @author.id, :comic_id => @comic.id
+        @speech = Factory.build :panel, :author_id => @author.id, :comic_id => @comic.id
       end
       it 'テストデータの確認' do
-        @speach.x = '1'
-        @speach.should be_valid
+        @speech.x = '1'
+        @speech.should be_valid
       end
       it '数値でなければ失敗する' do
-        @speach.x = 'a'
-        @speach.should_not be_valid
+        @speech.x = 'a'
+        @speech.should_not be_valid
       end
       it '0なら通る' do
-        @speach.x = '0'
-        @speach.should be_valid
+        @speech.x = '0'
+        @speech.should be_valid
       end
       it '負でも通る' do
-        @speach.x = -1
-        @speach.should be_valid
+        @speech.x = -1
+        @speech.should be_valid
       end
     end
     context 'yを検証するとき' do
       before do
-        @speach = Factory.build :panel, :author_id => @author.id, :comic_id => @comic.id
+        @speech = Factory.build :panel, :author_id => @author.id, :comic_id => @comic.id
       end
       it 'テストデータの確認' do
-        @speach.y = '1'
-        @speach.should be_valid
+        @speech.y = '1'
+        @speech.should be_valid
       end
       it '数値でなければ失敗する' do
-        @speach.y = 'a'
-        @speach.should_not be_valid
+        @speech.y = 'a'
+        @speech.should_not be_valid
       end
       it '0なら通る' do
-        @speach.y = '0'
-        @speach.should be_valid
+        @speech.y = '0'
+        @speech.should be_valid
       end
       it '負でも通る' do
-        @speach.y = -1
-        @speach.should be_valid
+        @speech.y = -1
+        @speech.should be_valid
       end
     end
     context 'zを検証するとき' do
       before do
-        @speach = Factory.build :panel, :author_id => @author.id, :comic_id => @comic.id
+        @speech = Factory.build :panel, :author_id => @author.id, :comic_id => @comic.id
       end
       it 'テストデータの確認' do
-        @speach.z = '1'
-        @speach.should be_valid
+        @speech.z = '1'
+        @speech.should be_valid
       end
       it '数値でなければ失敗する' do
-        @speach.z = 'a'
-        @speach.should_not be_valid
+        @speech.z = 'a'
+        @speech.should_not be_valid
       end
       it '0なら失敗する' do
-        @speach.z = '0'
-        @speach.should_not be_valid
+        @speech.z = '0'
+        @speech.should_not be_valid
       end
       it '負なら失敗する' do
-        @speach.z = -1
-        @speach.should_not be_valid
+        @speech.z = -1
+        @speech.should_not be_valid
       end
     end
     context 'tを検証するとき' do
       before do
-        @speach = Factory.build :panel, :author_id => @author.id, :comic_id => @comic.id
+        @speech = Factory.build :panel, :author_id => @author.id, :comic_id => @comic.id
       end
       it 'テストデータの確認' do
-        @speach.t = '1'
-        @speach.should be_valid
+        @speech.t = '1'
+        @speech.should be_valid
       end
       it '数値でなければ失敗する' do
-        @speach.t = 'a'
-        @speach.should_not be_valid
+        @speech.t = 'a'
+        @speech.should_not be_valid
       end
       it '0なら通る' do
-        @speach.t = '0'
-        @speach.should be_valid
+        @speech.t = '0'
+        @speech.should be_valid
       end
       it '負でも失敗する' do
-        @speach.t = -1
-        @speach.should_not be_valid
+        @speech.t = -1
+        @speech.should_not be_valid
       end
     end
     context 'author_idを検証するとき' do
       before do
-        @speach = Factory.build :panel, :author_id => @author.id, :comic_id => @comic.id
+        @speech = Factory.build :panel, :author_id => @author.id, :comic_id => @comic.id
       end
       it 'テストデータの確認' do
-        @speach.author_id = @author.id
-        @speach.should be_valid
+        @speech.author_id = @author.id
+        @speech.should be_valid
       end
       it 'nullなら失敗する' do
-        @speach.author_id = nil
-        @speach.should_not be_valid
+        @speech.author_id = nil
+        @speech.should_not be_valid
       end
       it '数値でなければ失敗する' do
-        @speach.author_id = 'a'
-        @speach.should_not be_valid
+        @speech.author_id = 'a'
+        @speech.should_not be_valid
       end
       it '存在する絵師でなければ失敗する' do
-        @speach.author_id = 0
-        @speach.should_not be_valid
+        @speech.author_id = 0
+        @speech.should_not be_valid
       end
     end
     context '全体を検証するとき' do
       before do
-        @speach = Factory :panel, :author_id => @author.id, :comic_id => @comic.id
+        @speech = Factory :panel, :author_id => @author.id, :comic_id => @comic.id
       end
     end
   end