mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
test refactor, don't hardcode primary_key_prefix_type
default.
/cc @zuhao
This commit is contained in:
parent
69274ce516
commit
89845ff866
1 changed files with 3 additions and 0 deletions
|
@ -92,6 +92,7 @@ class PrimaryKeysTest < ActiveRecord::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_primary_key_prefix
|
def test_primary_key_prefix
|
||||||
|
old_primary_key_prefix_type = ActiveRecord::Base.primary_key_prefix_type
|
||||||
ActiveRecord::Base.primary_key_prefix_type = :table_name
|
ActiveRecord::Base.primary_key_prefix_type = :table_name
|
||||||
Topic.reset_primary_key
|
Topic.reset_primary_key
|
||||||
assert_equal "topicid", Topic.primary_key
|
assert_equal "topicid", Topic.primary_key
|
||||||
|
@ -103,6 +104,8 @@ class PrimaryKeysTest < ActiveRecord::TestCase
|
||||||
ActiveRecord::Base.primary_key_prefix_type = nil
|
ActiveRecord::Base.primary_key_prefix_type = nil
|
||||||
Topic.reset_primary_key
|
Topic.reset_primary_key
|
||||||
assert_equal "id", Topic.primary_key
|
assert_equal "id", Topic.primary_key
|
||||||
|
ensure
|
||||||
|
ActiveRecord::Base.primary_key_prefix_type = old_primary_key_prefix_type
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_delete_should_quote_pkey
|
def test_delete_should_quote_pkey
|
||||||
|
|
Loading…
Reference in a new issue