OSDN Git Service

pass test
[pettanr/pettanr.git] / spec / models / speech_spec.rb
index 406b4ae..821f436 100644 (file)
 # -*- encoding: utf-8 -*-\r
-require 'spec_helper'
-
-describe Speech do
-  before do
-    Factory :admin
-    @license = Factory :license
-    @user = Factory( :user_yas)
-    @author = @user.author
-    
-    @panel = Factory :panel
-    @speech_balloon_template = Factory :speech_balloon_template
+require 'spec_helper'\r
+\r
+describe Speech do\r
+  before do\r
+    Factory :admin\r
+    @license = Factory :license\r
+    @user = Factory( :user_yas)\r
+    @author = @user.author\r
+    \r
+    @panel = Factory :panel\r
+    @speech_balloon_template = Factory :speech_balloon_template\r
     @speech_balloon = Factory :speech_balloon, :panel_id => @panel.id, :speech_balloon_template_id => @speech_balloon_template.id\r
   end\r
-  
-  describe '検証に於いて' do
-    it 'オーソドックスなデータなら通る' do
-      @speech = Factory.build :speech, :speech_balloon_id => @speech_balloon.id
-      @speech.should be_valid
+  \r
+  describe '検証に於いて' do\r
+    it 'オーソドックスなデータなら通る' do\r
+      @speech = Factory.build :speech, :speech_balloon_id => @speech_balloon.id\r
+      @speech.should be_valid\r
     end\r
-    
-    context 'speech_balloon_idを検証するとき' do
-      before do
-        @speech = Factory.build :speech, :speech_balloon_id => @speech_balloon.id
-      end
-      it 'テストデータの確認' do
-        @speech.speech_balloon_id = @speech_balloon.id
-        @speech.should be_valid
-      end
-      it 'nullなら失敗する' do
-        @speech.speech_balloon_id = nil
-        @speech.should_not be_valid
-      end
-      it '数値でなければ失敗する' do
-        @speech.speech_balloon_id = 'a'
-        @speech.should_not be_valid
-      end
-      it '存在するフキダシコミックでなければ失敗する' do
-        @speech.speech_balloon_id = 0
-        @speech.should_not be_valid
-      end
-    end
-    context 'contentを検証するとき' do
-    end
-    context 'xを検証するとき' do
-      before do
-        @speech = Factory.build :speech, :speech_balloon_id => @speech_balloon.id
-      end
-      it 'テストデータの確認' do
-        @speech.x = '1'
-        @speech.should be_valid
-      end
-      it 'nullなら失敗する' do
-        @speech.x = nil
-        @speech.should_not be_valid
-      end
-      it '数値でなければ失敗する' do
-        @speech.x = 'a'
-        @speech.should_not be_valid
-      end
-      it '0なら通る' do
-        @speech.x = '0'
-        @speech.should be_valid
-      end
-      it '負でも通る' do
-        @speech.x = -1
-        @speech.should be_valid
-      end
-    end
-    context 'yを検証するとき' do
-      before do
-        @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
-      end
-      it '0なら通る' do
-        @speech.y = '0'
-        @speech.should be_valid
-      end
-      it '負でも通る' do
-        @speech.y = -1
-        @speech.should be_valid
-      end
-    end
-    context 'widthを検証するとき' do
-      before do
-        @speech = Factory.build :speech, :speech_balloon_id => @speech_balloon.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
-    end
-    context 'heightを検証するとき' do
-      before do
-        @speech = Factory.build :speech, :speech_balloon_id => @speech_balloon.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 'settingsを検証するとき' do
-      before do
-        @speech = Factory.build :speech, :speech_balloon_id => @speech_balloon.id
-      end
-      it 'テストデータの確認' do
-        @speech.settings = ''
-        @speech.should be_valid
-      end
-    end
-  end
-  
-end
+    \r
+    context 'speech_balloon_idを検証するとき' do\r
+      before do\r
+        @speech = Factory.build :speech, :speech_balloon_id => @speech_balloon.id\r
+      end\r
+      it 'テストデータの確認' do\r
+        @speech.speech_balloon_id = @speech_balloon.id\r
+        @speech.should be_valid\r
+      end\r
+      it '数値でなければ失敗する' do\r
+        @speech.speech_balloon_id = 'a'\r
+        @speech.should_not be_valid\r
+      end\r
+    end\r
+    context 'contentを検証するとき' do\r
+    end\r
+    context 'xを検証するとき' do\r
+      before do\r
+        @speech = Factory.build :speech, :speech_balloon_id => @speech_balloon.id\r
+      end\r
+      it 'テストデータの確認' do\r
+        @speech.x = '1'\r
+        @speech.should be_valid\r
+      end\r
+      it 'nullなら失敗する' do\r
+        @speech.x = nil\r
+        @speech.should_not be_valid\r
+      end\r
+      it '数値でなければ失敗する' do\r
+        @speech.x = 'a'\r
+        @speech.should_not be_valid\r
+      end\r
+      it '0なら通る' do\r
+        @speech.x = '0'\r
+        @speech.should be_valid\r
+      end\r
+      it '負でも通る' do\r
+        @speech.x = -1\r
+        @speech.should be_valid\r
+      end\r
+    end\r
+    context 'yを検証するとき' do\r
+      before do\r
+        @speech = Factory.build :speech, :speech_balloon_id => @speech_balloon.id\r
+      end\r
+      it 'テストデータの確認' do\r
+        @speech.y = '1'\r
+        @speech.should be_valid\r
+      end\r
+      it 'nullなら失敗する' do\r
+        @speech.y = nil\r
+        @speech.should_not be_valid\r
+      end\r
+      it '数値でなければ失敗する' do\r
+        @speech.y = 'a'\r
+        @speech.should_not be_valid\r
+      end\r
+      it '0なら通る' do\r
+        @speech.y = '0'\r
+        @speech.should be_valid\r
+      end\r
+      it '負でも通る' do\r
+        @speech.y = -1\r
+        @speech.should be_valid\r
+      end\r
+    end\r
+    context 'widthを検証するとき' do\r
+      before do\r
+        @speech = Factory.build :speech, :speech_balloon_id => @speech_balloon.id\r
+      end\r
+      it 'テストデータの確認' do\r
+        @speech.width = 1\r
+        @speech.should be_valid\r
+      end\r
+      it 'nullなら失敗する' do\r
+        @speech.width = nil\r
+        @speech.should_not be_valid\r
+      end\r
+      it '数値でなければ失敗する' do\r
+        @speech.width = 'a'\r
+        @speech.should_not be_valid\r
+      end\r
+      it '0なら失敗する' do\r
+        @speech.width = '0'\r
+        @speech.should_not be_valid\r
+      end\r
+      it '負でも失敗する' do\r
+        @speech.width = -1\r
+        @speech.should_not be_valid\r
+      end\r
+    end\r
+    context 'heightを検証するとき' do\r
+      before do\r
+        @speech = Factory.build :speech, :speech_balloon_id => @speech_balloon.id\r
+      end\r
+      it 'テストデータの確認' do\r
+        @speech.height = '1'\r
+        @speech.should be_valid\r
+      end\r
+      it 'nullなら失敗する' do\r
+        @speech.height = nil\r
+        @speech.should_not be_valid\r
+      end\r
+      it '数値でなければ失敗する' do\r
+        @speech.height = 'a'\r
+        @speech.should_not be_valid\r
+      end\r
+      it '0なら失敗する' do\r
+        @speech.height = '0'\r
+        @speech.should_not be_valid\r
+      end\r
+      it '負でも失敗する' do\r
+        @speech.height = -1\r
+        @speech.should_not be_valid\r
+      end\r
+    end\r
+    context 'settingsを検証するとき' do\r
+      before do\r
+        @speech = Factory.build :speech, :speech_balloon_id => @speech_balloon.id\r
+      end\r
+      it 'テストデータの確認' do\r
+        @speech.settings = ''\r
+        @speech.should be_valid\r
+      end\r
+    end\r
+  end\r
+  \r
+end\r