aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2015-12-17 17:29:30 -0200
committerRafael França <rafaelmfranca@gmail.com>2015-12-17 17:29:30 -0200
commitdad0e081c4dc9dbbcdb195ff4e7f9ad4d2bc6de3 (patch)
tree41493eba7cc20ba77f4b0d89a993ffb6c91b29eb /test
parent746e3ad6ef3da9514aa1b1f172af4e5db6dc9797 (diff)
parent1120f8956729715027e47ddd76102c319d41a89b (diff)
downloadrails-dad0e081c4dc9dbbcdb195ff4e7f9ad4d2bc6de3.tar.gz
rails-dad0e081c4dc9dbbcdb195ff4e7f9ad4d2bc6de3.tar.bz2
rails-dad0e081c4dc9dbbcdb195ff4e7f9ad4d2bc6de3.zip
Merge pull request #329 from vipulnsward/add-attribute-aggregate-tests
Added test for verifying proper sql generated by minimum aggregate method
Diffstat (limited to 'test')
-rw-r--r--test/attributes/test_attribute.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/test/attributes/test_attribute.rb b/test/attributes/test_attribute.rb
index 0f6d6e447b..4e55069df4 100644
--- a/test/attributes/test_attribute.rb
+++ b/test/attributes/test_attribute.rb
@@ -330,7 +330,7 @@ module Arel
relation[:id].maximum.must_be_kind_of Nodes::Max
end
- it 'should generate the proper SQL' do
+ it 'should generate proper SQL' do
relation = Table.new(:users)
mgr = relation.project relation[:id].maximum
mgr.to_sql.must_be_like %{
@@ -345,6 +345,15 @@ module Arel
relation = Table.new(:users)
relation[:id].minimum.must_be_kind_of Nodes::Min
end
+
+ it 'should generate proper SQL' do
+ relation = Table.new(:users)
+ mgr = relation.project relation[:id].minimum
+ mgr.to_sql.must_be_like %{
+ SELECT MIN("users"."id")
+ FROM "users"
+ }
+ end
end
describe '#sum' do