aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/base_test.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2013-03-15 06:21:53 -0700
committerJon Leighton <j@jonathanleighton.com>2013-03-15 06:21:53 -0700
commit0721d3b37062eca73da3efd669142d7e381e4d80 (patch)
tree75a10eb4357b101161563c380e676412dcc4c455 /activerecord/test/cases/base_test.rb
parentdf21d1eaee11e82c9a83566e2d7c4b771e344686 (diff)
parentcd87c85ef05e47f6ea1ce7422ae033fe6d82b030 (diff)
downloadrails-0721d3b37062eca73da3efd669142d7e381e4d80.tar.gz
rails-0721d3b37062eca73da3efd669142d7e381e4d80.tar.bz2
rails-0721d3b37062eca73da3efd669142d7e381e4d80.zip
Merge pull request #9683 from senny/deprecate_count_distinct_option
rename `Relation#uniq` to `Relation#distinct`
Diffstat (limited to 'activerecord/test/cases/base_test.rb')
-rw-r--r--activerecord/test/cases/base_test.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb
index 9c73e4ca00..960c27da3e 100644
--- a/activerecord/test/cases/base_test.rb
+++ b/activerecord/test/cases/base_test.rb
@@ -1105,7 +1105,7 @@ class BasicsTest < ActiveRecord::TestCase
res6 = Post.count_by_sql "SELECT COUNT(DISTINCT p.id) FROM posts p, comments co WHERE p.#{QUOTED_TYPE} = 'Post' AND p.id=co.post_id"
res7 = nil
assert_nothing_raised do
- res7 = Post.where("p.#{QUOTED_TYPE} = 'Post' AND p.id=co.post_id").joins("p, comments co").select("p.id").count(distinct: true)
+ res7 = Post.where("p.#{QUOTED_TYPE} = 'Post' AND p.id=co.post_id").joins("p, comments co").select("p.id").distinct.count
end
assert_equal res6, res7
end
@@ -1499,6 +1499,12 @@ class BasicsTest < ActiveRecord::TestCase
assert_equal scope, Bird.uniq
end
+ def test_distinct_delegates_to_scoped
+ scope = stub
+ Bird.stubs(:all).returns(mock(:distinct => scope))
+ assert_equal scope, Bird.distinct
+ end
+
def test_table_name_with_2_abstract_subclasses
assert_equal "photos", Photo.table_name
end