OSDN Git Service

t#31085:raise err when input invalid encoding string
[pettanr/pettanr.git] / spec / models / author_spec.rb
index 7550611..f60b16d 100644 (file)
@@ -50,6 +50,21 @@ describe Author do
     end
   end
   
+  describe '文字コード検証に於いて' do
+    before do
+    end
+    
+    context 'nameを検証するとき' do
+      it 'Shift JISなら失敗する' do
+        @author.name = "\x83G\x83r\x83]\x83D"
+        lambda{
+          @author.valid_encode
+        }.should raise_error(Pettanr::BadRequest)
+      end
+    end
+    
+  end
+  
   describe 'デフォルト値補充に於いて' do
     it '名前がno nameになっている' do
       @author = FactoryGirl.build :author, :name => nil