Permalink
Browse files

There is no need to define test if a connection does not support prim…

…ary_key
  • Loading branch information...
yui-knk committed Jan 30, 2016
1 parent c4d85df commit e05d828b1f89f4a78e5eca67419275fb63cbeee2
Showing with 9 additions and 11 deletions.
  1. +9 −11 activerecord/test/cases/primary_keys_test.rb
@@ -135,22 +135,20 @@ def test_supports_primary_key
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

0 comments on commit e05d828

Please sign in to comment.