aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource
diff options
context:
space:
mode:
Diffstat (limited to 'activeresource')
-rw-r--r--activeresource/lib/active_resource/validations.rb2
-rw-r--r--activeresource/test/abstract_unit.rb3
-rw-r--r--activeresource/test/base_errors_test.rb4
3 files changed, 6 insertions, 3 deletions
diff --git a/activeresource/lib/active_resource/validations.rb b/activeresource/lib/active_resource/validations.rb
index 7fe3162c02..9d3d45b010 100644
--- a/activeresource/lib/active_resource/validations.rb
+++ b/activeresource/lib/active_resource/validations.rb
@@ -17,7 +17,7 @@ module ActiveResource
end
end
- add_to_base message if attr_message.nil?
+ self[:base] << message if attr_message.nil?
end
end
end
diff --git a/activeresource/test/abstract_unit.rb b/activeresource/test/abstract_unit.rb
index 0f11ea482a..ce9371d050 100644
--- a/activeresource/test/abstract_unit.rb
+++ b/activeresource/test/abstract_unit.rb
@@ -14,6 +14,9 @@ require 'setter_trap'
ActiveResource::Base.logger = Logger.new("#{File.dirname(__FILE__)}/debug.log")
+# Show backtraces for deprecated behavior for quicker cleanup.
+ActiveSupport::Deprecation.debug = true
+
def uses_gem(gem_name, test_name, version = '> 0')
gem gem_name.to_s, version
require gem_name.to_s
diff --git a/activeresource/test/base_errors_test.rb b/activeresource/test/base_errors_test.rb
index 8c177c8006..28813821df 100644
--- a/activeresource/test/base_errors_test.rb
+++ b/activeresource/test/base_errors_test.rb
@@ -20,7 +20,7 @@ class BaseErrorsTest < Test::Unit::TestCase
end
def test_should_parse_errors_to_individual_attributes
- assert @person.errors.invalid?(:name)
+ assert @person.errors[:name].any?
assert_equal ["can't be blank"], @person.errors[:age]
assert_equal ["can't be blank", "must start with a letter"], @person.errors[:name]
assert_equal ["Person quota full for today."], @person.errors[:base]
@@ -34,7 +34,7 @@ class BaseErrorsTest < Test::Unit::TestCase
def test_should_iterate_over_full_errors
errors = []
- @person.errors.each_full { |message| errors << message }
+ @person.errors.to_a.each { |message| errors << message }
assert errors.include?("Name can't be blank")
end