OSDN Git Service

refs #1610 エンコーディングがらみの例外をまず修正した
authorshimada <kshimada@appirits.com>
Wed, 5 Jun 2013 10:20:12 +0000 (19:20 +0900)
committershimada <kshimada@appirits.com>
Wed, 5 Jun 2013 10:20:12 +0000 (19:20 +0900)
config/locales/translation_ja.yml
spec/models/delivery_fee_spec.rb

index e9ea3bd..31d5985 100644 (file)
@@ -863,8 +863,5 @@ ja:
     errors:
       messages:
         record_invalid: "Validation failed: %{errors}"
-      # FIXME: バリデーションエラーメッセージが不正になるので full_messages 以下は記述しないこと
-      #   e.g.) obj.errors.fullmessages #=> "{:format=>\"%{attribute}%{message}\"}"
-      # activerecord-2.3.15/lib/active_record/validations.rb の作りが悪いせい?
-      #full_messages:
-      #  format: "%{attribute} %{message}"
+      full_messages:
+        format: "%{attribute}%{message}"
index 441743c..0065ce6 100644 (file)
@@ -39,5 +39,11 @@ describe DeliveryFee do
     end
   end
   
-    
+  describe "バリデーションメッセージ" do
+    it '値段に数値以外' do
+      @delivery_fee.price = '123abc'
+      @delivery_fee.should_not be_valid
+      @delivery_fee.errors.full_messages[0].should == '価格は数値で入力してください。'
+    end
+  end
 end