class PrimaryKeyWithNoConnectionTest

Public Instance Methods

test_set_primary_key_with_no_connection() click to toggle source
# File activerecord/test/cases/primary_keys_test.rb, line 229
def test_set_primary_key_with_no_connection
  connection = ActiveRecord::Base.remove_connection

  model = Class.new(ActiveRecord::Base)
  model.primary_key = "foo"

  assert_equal "foo", model.primary_key

  ActiveRecord::Base.establish_connection(connection)

  assert_equal "foo", model.primary_key
end