Permalink
Browse files

Make use of new I18n configuration on ActiveModel.

  • Loading branch information...
1 parent 62a4ca5 commit 0a2cf993ecb0efdf06cbe10a03c29dea34f7632d @josevalim josevalim committed Jan 14, 2010
Showing with 6 additions and 17 deletions.
  1. +1 −4 lib/mail_form.rb
  2. +0 −4 lib/mail_form/locales/amo.en.yml
  3. +0 −4 lib/mail_form/locales/ar.en.yml
  4. +3 −3 test/mail_form_test.rb
  5. +2 −2 test/resource_test.rb
View
@@ -49,7 +49,4 @@ def get_from_class_and_eval(resource, method)
duck
end
end
-end
-
-base = defined?(ActiveRecord) ? :ar : :amo
-I18n.load_path.unshift File.expand_path("mail_form/locales/#{base}.en.yml", File.dirname(__FILE__))
+end
@@ -1,4 +0,0 @@
-en:
- mail_form:
- errors:
- messages: :"activemodel.errors.messages"
@@ -1,4 +0,0 @@
-en:
- mail_form:
- errors:
- messages: :"activerecord.errors.messages"
View
@@ -35,7 +35,7 @@ def test_subject_is_a_string
def test_sender_defaults_to_form_email
@form.deliver
- assert_equal ['my.email@my.domain.com'], ActionMailer::Base.deliveries.first.from
+ assert_equal 'my.email@my.domain.com', ActionMailer::Base.deliveries.first.from
end
def test_error_is_raised_when_recipients_is_nil
@@ -46,7 +46,7 @@ def test_error_is_raised_when_recipients_is_nil
def test_recipients_is_a_string
@form.deliver
- assert_equal ['my.email@my.domain.com'], ActionMailer::Base.deliveries.first.to
+ assert_equal 'my.email@my.domain.com', ActionMailer::Base.deliveries.first.to
end
def test_recipients_is_an_array
@@ -61,7 +61,7 @@ def test_recipients_is_a_symbold
def test_headers_is_a_hash
@advanced.deliver
- assert_equal '<mypath>', ActionMailer::Base.deliveries.first.header['return-path'].to_s
+ assert_equal 'mypath', ActionMailer::Base.deliveries.first.header['return-path'].to_s
end
def test_body_contains_subject
View
@@ -114,11 +114,11 @@ def test_activemodel_linked_errors
end
def test_activemodel_errors_lookups_model_keys
- I18n.backend.store_translations(:en, :mail_form => { :errors => { :models => { :contact_form =>
+ I18n.backend.store_translations(:en, :errors => { :models => { :contact_form =>
{ :attributes => { :email => { :invalid => 'fill in the email' },
:name => { :blank => 'fill in the name' } }
}
- }}})
+ }})
form = ContactForm.new(:email => 'not_valid')
form.valid?

0 comments on commit 0a2cf99

Please sign in to comment.