aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2016-07-20 02:23:00 -0300
committerGitHub <noreply@github.com>2016-07-20 02:23:00 -0300
commitf980dee24eb500e2a8a6e25b2fd13dbe2ce5b62d (patch)
tree7e70d9d721cf40bc52aa7f100ee8ad05c65f2db9 /activerecord/test/cases
parentb8d7bcf93ec21688ad2c7ea3d2d9b591de1b04d1 (diff)
parentcf09d5bd63a6c886d0417163de2e966669c52809 (diff)
downloadrails-f980dee24eb500e2a8a6e25b2fd13dbe2ce5b62d.tar.gz
rails-f980dee24eb500e2a8a6e25b2fd13dbe2ce5b62d.tar.bz2
rails-f980dee24eb500e2a8a6e25b2fd13dbe2ce5b62d.zip
Merge pull request #25578 from kamipo/move_warning_about_composite_primary_key_to_attribute_methods_primary_key
Move the warning about composite primary key to `AttributeMethods::PrimaryKey`
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb2
-rw-r--r--activerecord/test/cases/primary_keys_test.rb10
2 files changed, 9 insertions, 3 deletions
diff --git a/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb b/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb
index 1bbca84bb2..e27f16b6e4 100644
--- a/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb
+++ b/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb
@@ -156,7 +156,7 @@ class HasAndBelongsToManyAssociationsTest < ActiveRecord::TestCase
warning = capture(:stderr) do
country.treaties << treaty
end
- assert_no_match(/WARNING: Rails does not support composite primary key\./, warning)
+ assert_no_match(/WARNING: Active Record does not support composite primary key\./, warning)
end
def test_has_and_belongs_to_many
diff --git a/activerecord/test/cases/primary_keys_test.rb b/activerecord/test/cases/primary_keys_test.rb
index 4267ad4a24..ea36c199f4 100644
--- a/activerecord/test/cases/primary_keys_test.rb
+++ b/activerecord/test/cases/primary_keys_test.rb
@@ -255,6 +255,7 @@ class CompositePrimaryKeyTest < ActiveRecord::TestCase
def setup
@connection = ActiveRecord::Base.connection
+ @connection.schema_cache.clear!
@connection.create_table(:barcodes, primary_key: ["region", "code"], force: true) do |t|
t.string :region
t.integer :code
@@ -270,10 +271,15 @@ class CompositePrimaryKeyTest < ActiveRecord::TestCase
end
def test_primary_key_issues_warning
+ model = Class.new(ActiveRecord::Base) do
+ def self.table_name
+ "barcodes"
+ end
+ end
warning = capture(:stderr) do
- assert_nil @connection.primary_key("barcodes")
+ assert_nil model.primary_key
end
- assert_match(/WARNING: Rails does not support composite primary key\./, warning)
+ assert_match(/WARNING: Active Record does not support composite primary key\./, warning)
end
def test_collectly_dump_composite_primary_key