diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-10 11:39:50 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-10 11:39:50 -0700 |
commit | 6032d40c1d1c7a7681f145c30b4c26386395ba45 (patch) | |
tree | de49d1734e3d3088304b8c092ea1cbd72d5e65fc /spec/arel/attributes | |
parent | e7648f26921d66f1375645808a5266d8e0e3edcf (diff) | |
download | rails-6032d40c1d1c7a7681f145c30b4c26386395ba45.tar.gz rails-6032d40c1d1c7a7681f145c30b4c26386395ba45.tar.bz2 rails-6032d40c1d1c7a7681f145c30b4c26386395ba45.zip |
added greater than or equal to node
Diffstat (limited to 'spec/arel/attributes')
-rw-r--r-- | spec/arel/attributes/attribute_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/arel/attributes/attribute_spec.rb b/spec/arel/attributes/attribute_spec.rb index fb6954dc7e..ee12aa2371 100644 --- a/spec/arel/attributes/attribute_spec.rb +++ b/spec/arel/attributes/attribute_spec.rb @@ -3,6 +3,22 @@ require 'spec_helper' module Arel module Attributes describe 'attribute' do + describe '#gteq' do + it 'should create a GreaterThanOrEqual node' do + relation = Table.new(:users) + relation[:id].gteq(10).should be_kind_of Nodes::GreaterThanOrEqual + end + + it 'should generate >= in sql' do + relation = Table.new(:users) + mgr = relation.project relation[:id] + mgr.where relation[:id].gteq(10) + mgr.to_sql.should be_like %{ + SELECT "users"."id" FROM "users" WHERE "users"."id" >= 10 + } + end + end + describe '#average' do it 'should create a AVG node' do relation = Table.new(:users) |