mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Use current_adapter?
over ActiveRecord::Base.connection.adapter_name
in tests
This commit is contained in:
parent
534de08d51
commit
7dc16ddd48
2 changed files with 3 additions and 9 deletions
|
@ -6,14 +6,8 @@ require "models/topic"
|
|||
class TestColumnAlias < ActiveRecord::TestCase
|
||||
fixtures :topics
|
||||
|
||||
QUERY = if "Oracle" == ActiveRecord::Base.connection.adapter_name
|
||||
"SELECT id AS pk FROM topics WHERE ROWNUM < 2"
|
||||
else
|
||||
"SELECT id AS pk FROM topics"
|
||||
end
|
||||
|
||||
def test_column_alias
|
||||
records = Topic.connection.select_all(QUERY)
|
||||
assert_equal "pk", records[0].keys[0]
|
||||
records = Topic.connection.select_all("SELECT id AS pk FROM topics")
|
||||
assert_equal ["pk"], records.columns
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1103,7 +1103,7 @@ class FoxyFixturesTest < ActiveRecord::TestCase
|
|||
fixtures :parrots, :parrots_pirates, :pirates, :treasures, :mateys, :ships, :computers,
|
||||
:developers, :"admin/accounts", :"admin/users", :live_parrots, :dead_parrots, :books
|
||||
|
||||
if ActiveRecord::Base.connection.adapter_name == "PostgreSQL"
|
||||
if current_adapter?(:PostgreSQLAdapter)
|
||||
require "models/uuid_parent"
|
||||
require "models/uuid_child"
|
||||
fixtures :uuid_parents, :uuid_children
|
||||
|
|
Loading…
Reference in a new issue