aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test')
-rwxr-xr-xactiverecord/test/base_test.rb9
-rw-r--r--activerecord/test/fixtures/customer.rb4
2 files changed, 13 insertions, 0 deletions
diff --git a/activerecord/test/base_test.rb b/activerecord/test/base_test.rb
index 391ee57632..63bc3ea6a2 100755
--- a/activerecord/test/base_test.rb
+++ b/activerecord/test/base_test.rb
@@ -2,6 +2,7 @@ require 'abstract_unit'
require 'fixtures/topic'
require 'fixtures/reply'
require 'fixtures/company'
+require 'fixtures/customer'
require 'fixtures/developer'
require 'fixtures/project'
require 'fixtures/default'
@@ -721,6 +722,14 @@ class BasicsTest < Test::Unit::TestCase
task.attributes = attributes
assert_equal time, task.starting
end
+
+ def test_multiparameter_assignment_of_aggregation
+ customer = Customer.new
+ address = Address.new("The Street", "The City", "The Country")
+ attributes = { "address(1)" => address.street, "address(2)" => address.city, "address(3)" => address.country }
+ customer.attributes = attributes
+ assert_equal address, customer.address
+ end
def test_attributes_on_dummy_time
# Oracle and SQL Server do not have a TIME datatype.
diff --git a/activerecord/test/fixtures/customer.rb b/activerecord/test/fixtures/customer.rb
index 2eba052eee..e23fd03ade 100644
--- a/activerecord/test/fixtures/customer.rb
+++ b/activerecord/test/fixtures/customer.rb
@@ -14,6 +14,10 @@ class Address
def close_to?(other_address)
city == other_address.city && country == other_address.country
end
+
+ def ==(other)
+ other.is_a?(self.class) && other.street == street && other.city == city && other.country == country
+ end
end
class Money