aboutsummaryrefslogtreecommitdiffstats
path: root/test/attributes/test_attribute.rb
diff options
context:
space:
mode:
authorVipul A M <vipulnsward@gmail.com>2014-10-24 12:26:02 +0530
committerVipul A M <vipulnsward@gmail.com>2014-10-24 12:26:02 +0530
commit1120f8956729715027e47ddd76102c319d41a89b (patch)
tree08c759dbc0bc7d83152e10ee77bb07bb7dd22f0a /test/attributes/test_attribute.rb
parent0e6c7e6de73fdddaf7f1486657f4d9f8e8f5fde3 (diff)
downloadrails-1120f8956729715027e47ddd76102c319d41a89b.tar.gz
rails-1120f8956729715027e47ddd76102c319d41a89b.tar.bz2
rails-1120f8956729715027e47ddd76102c319d41a89b.zip
- Added test for verifying proper sql generated by minimum aggregate method.
Diffstat (limited to 'test/attributes/test_attribute.rb')
-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 b50bb60b1e..768df23d4d 100644
--- a/test/attributes/test_attribute.rb
+++ b/test/attributes/test_attribute.rb
@@ -329,7 +329,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 %{
@@ -344,6 +344,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