aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test/cases
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2009-09-05 19:10:21 -0500
committerJoshua Peek <josh@joshpeek.com>2009-09-05 19:10:21 -0500
commit6dc9ad80e6ee4a581c5ace005632373fe7275c03 (patch)
tree03062826db52ad3f435c634f327028a89704cb26 /activemodel/test/cases
parentc6e0923245a2e50cd7e1db11741a66569bfd6812 (diff)
downloadrails-6dc9ad80e6ee4a581c5ace005632373fe7275c03.tar.gz
rails-6dc9ad80e6ee4a581c5ace005632373fe7275c03.tar.bz2
rails-6dc9ad80e6ee4a581c5ace005632373fe7275c03.zip
Fix warnings in AMo
Diffstat (limited to 'activemodel/test/cases')
-rw-r--r--activemodel/test/cases/observing_test.rb1
-rw-r--r--activemodel/test/cases/serializeration/json_serialization_test.rb2
-rw-r--r--activemodel/test/cases/serializeration/xml_serialization_test.rb2
-rw-r--r--activemodel/test/cases/validations/i18n_validation_test.rb46
4 files changed, 4 insertions, 47 deletions
diff --git a/activemodel/test/cases/observing_test.rb b/activemodel/test/cases/observing_test.rb
index fbf93c19ef..e23bda0528 100644
--- a/activemodel/test/cases/observing_test.rb
+++ b/activemodel/test/cases/observing_test.rb
@@ -78,6 +78,7 @@ class ObserverTest < ActiveModel::TestCase
def teardown
FooObserver.instance_eval do
+ undef_method :observed_classes
alias_method :observed_classes, :original_observed_classes
end
end
diff --git a/activemodel/test/cases/serializeration/json_serialization_test.rb b/activemodel/test/cases/serializeration/json_serialization_test.rb
index d4c7c31633..81df52fcb9 100644
--- a/activemodel/test/cases/serializeration/json_serialization_test.rb
+++ b/activemodel/test/cases/serializeration/json_serialization_test.rb
@@ -8,7 +8,7 @@ class Contact
def attributes
instance_values
- end
+ end unless method_defined?(:attributes)
end
class JsonSerializationTest < ActiveModel::TestCase
diff --git a/activemodel/test/cases/serializeration/xml_serialization_test.rb b/activemodel/test/cases/serializeration/xml_serialization_test.rb
index 7212719c2d..6340aad531 100644
--- a/activemodel/test/cases/serializeration/xml_serialization_test.rb
+++ b/activemodel/test/cases/serializeration/xml_serialization_test.rb
@@ -8,7 +8,7 @@ class Contact
def attributes
instance_values
- end
+ end unless method_defined?(:attributes)
end
module Admin
diff --git a/activemodel/test/cases/validations/i18n_validation_test.rb b/activemodel/test/cases/validations/i18n_validation_test.rb
index cc68d847a2..544b680b4b 100644
--- a/activemodel/test/cases/validations/i18n_validation_test.rb
+++ b/activemodel/test/cases/validations/i18n_validation_test.rb
@@ -107,32 +107,6 @@ class I18nValidationTest < ActiveModel::TestCase
@person.valid?
end
- def test_validates_length_of_within_generates_message_with_title_too_short
- Person.validates_length_of :title, :within => 3..5
- @person.errors.expects(:generate_message).with(:title, :too_short, {:count => 3, :default => nil})
- @person.valid?
- end
-
- def test_validates_length_of_within_generates_message_with_title_too_short_and_custom_default_message
- Person.validates_length_of :title, :within => 3..5, :too_short => 'custom'
- @person.errors.expects(:generate_message).with(:title, :too_short, {:count => 3, :default => 'custom'})
- @person.valid?
- end
-
- def test_validates_length_of_within_generates_message_with_title_too_long
- Person.validates_length_of :title, :within => 3..5
- @person.title = 'this title is too long'
- @person.errors.expects(:generate_message).with(:title, :too_long, {:count => 5, :default => nil})
- @person.valid?
- end
-
- def test_validates_length_of_within_generates_message_with_title_too_long_and_custom_default_message
- Person.validates_length_of :title, :within => 3..5, :too_long => 'custom'
- @person.title = 'this title is too long'
- @person.errors.expects(:generate_message).with(:title, :too_long, {:count => 5, :default => 'custom'})
- @person.valid?
- end
-
# validates_length_of :within w/ mocha
def test_validates_length_of_within_generates_message_with_title_too_short
@@ -280,7 +254,7 @@ class I18nValidationTest < ActiveModel::TestCase
@person.valid?
end
- def test_validates_numericality_of_odd_generates_message_with_custom_default_message
+ def test_validates_numericality_of_less_than_odd_generates_message_with_custom_default_message
Person.validates_numericality_of :title, :only_integer => true, :less_than => 0, :message => 'custom'
@person.title = 1
@person.errors.expects(:generate_message).with(:title, :less_than, {:value => 1, :count => 0, :default => 'custom'})
@@ -384,24 +358,6 @@ class I18nValidationTest < ActiveModel::TestCase
assert_equal ['global message'], @person.errors[:title]
end
- def test_validates_length_of_is_finds_custom_model_key_translation
- I18n.backend.store_translations 'en', :activemodel => {:errors => {:models => {:person => {:attributes => {:title => {:wrong_length => 'custom message'}}}}}}
- I18n.backend.store_translations 'en', :activemodel => {:errors => {:messages => {:wrong_length => 'global message'}}}
-
- Person.validates_length_of :title, :is => 5
- @person.valid?
- assert_equal ['custom message'], @person.errors[:title]
- end
-
- def test_validates_length_of_is_finds_global_default_translation
- I18n.backend.store_translations 'en', :activemodel => {:errors => {:messages => {:wrong_length => 'global message'}}}
-
- Person.validates_length_of :title, :is => 5
- @person.valid?
- assert_equal ['global message'], @person.errors[:title]
- end
-
-
# validates_format_of w/o mocha
def test_validates_format_of_finds_custom_model_key_translation