From: shimada Date: Wed, 5 Jun 2013 10:20:12 +0000 (+0900) Subject: refs #1610 エンコーディングがらみの例外をまず修正した X-Git-Tag: 3.0.0~2^2 X-Git-Url: http://git.osdn.net/view?p=elecoma%2Felecoma.git;a=commitdiff_plain;h=7c8ce8a9889522535c2c0c375f2665a1dd6f3095 refs #1610 エンコーディングがらみの例外をまず修正した --- diff --git a/config/locales/translation_ja.yml b/config/locales/translation_ja.yml index e9ea3bd..31d5985 100644 --- a/config/locales/translation_ja.yml +++ b/config/locales/translation_ja.yml @@ -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}" diff --git a/spec/models/delivery_fee_spec.rb b/spec/models/delivery_fee_spec.rb index 441743c..0065ce6 100644 --- a/spec/models/delivery_fee_spec.rb +++ b/spec/models/delivery_fee_spec.rb @@ -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