aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-01-04 01:05:19 +0100
committerJosé Valim <jose.valim@gmail.com>2010-01-04 01:05:19 +0100
commiteca11bfdb5d3cf375faf8a24e2dc0cc5abd20f92 (patch)
treed4c36dc7a14a280a948577f065132f74186f3891 /activerecord/test/cases
parentb0947bf97c0ac313799f6f1ca739b5666f5fe19f (diff)
parenta68165833a7ba50a1e3d731afe8934d19e3ced99 (diff)
downloadrails-eca11bfdb5d3cf375faf8a24e2dc0cc5abd20f92.tar.gz
rails-eca11bfdb5d3cf375faf8a24e2dc0cc5abd20f92.tar.bz2
rails-eca11bfdb5d3cf375faf8a24e2dc0cc5abd20f92.zip
Merge branch 'master' of git://github.com/rails/rails
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/multiple_db_test.rb6
-rw-r--r--activerecord/test/cases/relations_test.rb8
2 files changed, 14 insertions, 0 deletions
diff --git a/activerecord/test/cases/multiple_db_test.rb b/activerecord/test/cases/multiple_db_test.rb
index 7c3e0f2ca6..6155bfd50a 100644
--- a/activerecord/test/cases/multiple_db_test.rb
+++ b/activerecord/test/cases/multiple_db_test.rb
@@ -1,5 +1,6 @@
require "cases/helper"
require 'models/entrant'
+require 'models/bird'
# So we can test whether Course.connection survives a reload.
require_dependency 'models/course'
@@ -82,4 +83,9 @@ class MultipleDbTest < ActiveRecord::TestCase
assert_equal "Ruby Development", Course.find(1).name
assert_equal "Ruby Developer", Entrant.find(1).name
end
+
+ def test_arel_table_engines
+ assert_not_equal Entrant.active_relation_engine, Course.active_relation_engine
+ assert_equal Entrant.active_relation_engine, Bird.active_relation_engine
+ end
end
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb
index f895f8b8d2..195889f1df 100644
--- a/activerecord/test/cases/relations_test.rb
+++ b/activerecord/test/cases/relations_test.rb
@@ -545,6 +545,14 @@ class RelationTest < ActiveRecord::TestCase
assert_equal 'hen', hen.name
end
+ def test_explicit_create_scope
+ hens = Bird.where(:name => 'hen')
+ assert_equal 'hen', hens.new.name
+
+ hens = hens.create_with(:name => 'cock')
+ assert_equal 'cock', hens.new.name
+ end
+
def test_except
relation = Post.where(:author_id => 1).order('id ASC').limit(1)
assert_equal [posts(:welcome)], relation.all