Created
May 13, 2011 12:56
-
-
Save flavorjones/970483 to your computer and use it in GitHub Desktop.
Patch containing failing test for rails/rails issue 539.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 641e1e0bebdea1cf5ad4e156afe0ecb6a91241c4 Mon Sep 17 00:00:00 2001 | |
From: Mike Dalessio <[email protected]> | |
Date: Fri, 13 May 2011 08:53:49 -0400 | |
Subject: [PATCH] Test for table join across databases (connections). | |
--- | |
.../test/cases/associations/join_model_test.rb | 11 +++++++++++ | |
1 files changed, 11 insertions(+), 0 deletions(-) | |
diff --git a/activerecord/test/cases/associations/join_model_test.rb b/activerecord/test/cases/associations/join_model_test.rb | |
index 49a1c11..addb93e 100644 | |
--- a/activerecord/test/cases/associations/join_model_test.rb | |
+++ b/activerecord/test/cases/associations/join_model_test.rb | |
@@ -13,6 +13,8 @@ require 'models/vertex' | |
require 'models/edge' | |
require 'models/book' | |
require 'models/citation' | |
+require 'models/course' | |
+require 'models/entrant' | |
class AssociationsJoinModelTest < ActiveRecord::TestCase | |
self.use_transactional_fixtures = false unless supports_savepoints? | |
@@ -704,6 +706,15 @@ class AssociationsJoinModelTest < ActiveRecord::TestCase | |
assert_equal [9, 10, new_comment.id], authors(:david).sti_post_comments.map(&:id).sort | |
end | |
+ def test_join_across_tables_in_different_databases | |
+ history = Course.create! :name => "History of the American Automobile" | |
+ death_mech = Course.create! :name => "Classical Mechanics" | |
+ boss = Entrant.create! :name => "Charles Kettering", :course => history | |
+ isaac = Entrant.create! :name => "Sir Isaac Newton", :course => death_mech | |
+ | |
+ assert_equal [history], Course.joins(:entrants).where(:entrants => {:name => "Charles Kettering"}).to_a | |
+ end | |
+ | |
private | |
# create dynamic Post models to allow different dependency options | |
def find_post_with_dependency(post_id, association, association_name, dependency) | |
-- | |
1.7.4.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment