From da9b5d4a8435b744fcf278fffd6d7f1e36d4a4f2 Mon Sep 17 00:00:00 2001 From: Yves Senn Date: Mon, 13 May 2013 18:31:00 +0100 Subject: Remove fall back and column restrictions for `count`. --- activerecord/test/cases/calculations_test.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'activerecord/test') diff --git a/activerecord/test/cases/calculations_test.rb b/activerecord/test/cases/calculations_test.rb index c8ac77984f..0f3f9aecfc 100644 --- a/activerecord/test/cases/calculations_test.rb +++ b/activerecord/test/cases/calculations_test.rb @@ -167,6 +167,15 @@ class CalculationsTest < ActiveRecord::TestCase assert_no_match(/OFFSET/, queries.first) end + def test_count_on_invalid_columns_raises + e = assert_raises(ActiveRecord::StatementInvalid) { + Account.select("credit_limit, firm_name").count + } + + assert_match "accounts", e.message + assert_match "credit_limit, firm_name", e.message + end + def test_should_group_by_summed_field_having_condition c = Account.group(:firm_id).having('sum(credit_limit) > 50').sum(:credit_limit) assert_nil c[1] -- cgit v1.2.3