mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Change JoinPart test from an integration to a unit test
This commit is contained in:
parent
6050d0177c
commit
07dad778d1
2 changed files with 8 additions and 13 deletions
|
@ -39,19 +39,6 @@ class EagerAssociationTest < ActiveRecord::TestCase
|
||||||
assert_nil member.favourite_club
|
assert_nil member.favourite_club
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_loading_with_one_association_without_primary_key
|
|
||||||
Comment.primary_key = nil
|
|
||||||
begin
|
|
||||||
assert_nothing_raised do
|
|
||||||
Post.includes(:comments).references(:comments).all
|
|
||||||
end
|
|
||||||
rescue
|
|
||||||
raise $!
|
|
||||||
ensure
|
|
||||||
Comment.primary_key = 'id'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_loading_with_one_association
|
def test_loading_with_one_association
|
||||||
posts = Post.find(:all, :include => :comments)
|
posts = Post.find(:all, :include => :comments)
|
||||||
post = posts.find { |p| p.id == 1 }
|
post = posts.find { |p| p.id == 1 }
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
require "cases/helper"
|
||||||
|
require 'models/edge'
|
||||||
|
|
||||||
|
class JoinDependencyTest < ActiveRecord::TestCase
|
||||||
|
def test_column_names_with_alias_handles_nil_primary_key
|
||||||
|
assert_equal Edge.column_names, ActiveRecord::Associations::JoinDependency::JoinBase.new(Edge).column_names_with_alias.map(&:first)
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue