aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb
diff options
context:
space:
mode:
authorMatt Hanlon <hanlon@skytap.com>2015-08-07 12:33:09 -0700
committerMatt Hanlon <hanlon@skytap.com>2015-08-07 12:33:09 -0700
commit5ec9e9349e320e5547c8b36266dbeed07082dd51 (patch)
treed70c4d41c6e608c1d1f677c6954911f4c43a940d /activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb
parent3fb5cd4d407840ce0a40e4fc82e07a33768a00be (diff)
downloadrails-5ec9e9349e320e5547c8b36266dbeed07082dd51.tar.gz
rails-5ec9e9349e320e5547c8b36266dbeed07082dd51.tar.bz2
rails-5ec9e9349e320e5547c8b36266dbeed07082dd51.zip
use correct DB connection for generated HABTM table
Diffstat (limited to 'activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb')
-rw-r--r--activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb b/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb
index abbe37ab38..7718b29125 100644
--- a/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb
+++ b/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb
@@ -3,6 +3,7 @@ require 'models/developer'
require 'models/computer'
require 'models/project'
require 'models/company'
+require 'models/course'
require 'models/customer'
require 'models/order'
require 'models/categorization'
@@ -14,6 +15,7 @@ require 'models/tagging'
require 'models/parrot'
require 'models/person'
require 'models/pirate'
+require 'models/professor'
require 'models/treasure'
require 'models/price_estimate'
require 'models/club'
@@ -923,4 +925,14 @@ class HasAndBelongsToManyAssociationsTest < ActiveRecord::TestCase
assert_deprecated { developer.projects(true) }
end
+
+ def test_alternate_database
+ professor = Professor.create(name: "Plum")
+ course = Course.create(name: "Forensics")
+ assert_equal 0, professor.courses.count
+ assert_nothing_raised do
+ professor.courses << course
+ end
+ assert_equal 1, professor.courses.count
+ end
end