aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorPiotr Sarnacki <drogus@gmail.com>2013-02-03 15:27:42 +0400
committerAlan Daud <olancheg@gmail.com>2013-02-03 15:27:42 +0400
commit6a0a5f30324571416174430cf41f3355635c3328 (patch)
tree5748a3db0e1f3a53faf2290db883a05db435145a /activerecord/test
parentbf794bb36f3bd06e2e863cd6c6dfb6ceae116af2 (diff)
downloadrails-6a0a5f30324571416174430cf41f3355635c3328.tar.gz
rails-6a0a5f30324571416174430cf41f3355635c3328.tar.bz2
rails-6a0a5f30324571416174430cf41f3355635c3328.zip
Duplicate column_defaults properly
Backport c517602 to fix #6115 Deleted: activerecord/lib/active_record/core.rb Conflicts: activerecord/test/cases/base_test.rb
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/base_test.rb8
-rw-r--r--activerecord/test/schema/schema.rb1
2 files changed, 8 insertions, 1 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb
index b849eead26..97d6c0cf88 100644
--- a/activerecord/test/cases/base_test.rb
+++ b/activerecord/test/cases/base_test.rb
@@ -325,6 +325,12 @@ class BasicsTest < ActiveRecord::TestCase
assert parrot.valid?
end
+ def test_default_values_are_deeply_dupped
+ company = Company.new
+ company.description << "foo"
+ assert_equal "", Company.new.description
+ end
+
def test_load
topics = Topic.find(:all, :order => 'id')
assert_equal(4, topics.size)
@@ -2148,7 +2154,7 @@ class BasicsTest < ActiveRecord::TestCase
end
def test_attribute_names
- assert_equal ["id", "type", "ruby_type", "firm_id", "firm_name", "name", "client_of", "rating", "account_id"],
+ assert_equal ["id", "type", "ruby_type", "firm_id", "firm_name", "name", "client_of", "rating", "account_id", "description"],
Company.attribute_names
end
diff --git a/activerecord/test/schema/schema.rb b/activerecord/test/schema/schema.rb
index 32982e4f82..1ad4d971f4 100644
--- a/activerecord/test/schema/schema.rb
+++ b/activerecord/test/schema/schema.rb
@@ -176,6 +176,7 @@ ActiveRecord::Schema.define do
t.integer :client_of
t.integer :rating, :default => 1
t.integer :account_id
+ t.string :description, :null => false, :default => ""
end
add_index :companies, [:firm_id, :type, :rating, :ruby_type], :name => "company_index"