diff options
author | yui-knk <spiketeika@gmail.com> | 2016-01-31 00:01:26 +0900 |
---|---|---|
committer | yui-knk <spiketeika@gmail.com> | 2016-01-31 00:01:26 +0900 |
commit | e05d828b1f89f4a78e5eca67419275fb63cbeee2 (patch) | |
tree | 8b411ce9a7fbba1b6d46c3e6d2369d8cd2a89871 /activerecord/test | |
parent | c4d85dfbc71043e2a746acd310e32f4f04db801a (diff) | |
download | rails-e05d828b1f89f4a78e5eca67419275fb63cbeee2.tar.gz rails-e05d828b1f89f4a78e5eca67419275fb63cbeee2.tar.bz2 rails-e05d828b1f89f4a78e5eca67419275fb63cbeee2.zip |
There is no need to define test if a connection does not support primary_key
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/primary_keys_test.rb | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/activerecord/test/cases/primary_keys_test.rb b/activerecord/test/cases/primary_keys_test.rb index 7e18313c00..8ce2b813bf 100644 --- a/activerecord/test/cases/primary_keys_test.rb +++ b/activerecord/test/cases/primary_keys_test.rb @@ -135,22 +135,20 @@ class PrimaryKeysTest < ActiveRecord::TestCase end end - def test_primary_key_returns_value_if_it_exists - klass = Class.new(ActiveRecord::Base) do - self.table_name = 'developers' - end + if ActiveRecord::Base.connection.supports_primary_key? + def test_primary_key_returns_value_if_it_exists + klass = Class.new(ActiveRecord::Base) do + self.table_name = 'developers' + end - if ActiveRecord::Base.connection.supports_primary_key? assert_equal 'id', klass.primary_key end - end - def test_primary_key_returns_nil_if_it_does_not_exist - klass = Class.new(ActiveRecord::Base) do - self.table_name = 'developers_projects' - end + def test_primary_key_returns_nil_if_it_does_not_exist + klass = Class.new(ActiveRecord::Base) do + self.table_name = 'developers_projects' + end - if ActiveRecord::Base.connection.supports_primary_key? assert_nil klass.primary_key end end |