From 9fdaf497cb346696ea538308b77ec07f051cd569 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 10 Sep 2010 11:47:03 -0700 Subject: added a greater than node --- spec/arel/attributes/attribute_spec.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'spec/arel') diff --git a/spec/arel/attributes/attribute_spec.rb b/spec/arel/attributes/attribute_spec.rb index ee12aa2371..ae0f70c5ba 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 '#gt' do + it 'should create a GreaterThan node' do + relation = Table.new(:users) + relation[:id].gt(10).should be_kind_of Nodes::GreaterThan + end + + it 'should generate >= in sql' do + relation = Table.new(:users) + mgr = relation.project relation[:id] + mgr.where relation[:id].gt(10) + mgr.to_sql.should be_like %{ + SELECT "users"."id" FROM "users" WHERE "users"."id" > 10 + } + end + end + describe '#gteq' do it 'should create a GreaterThanOrEqual node' do relation = Table.new(:users) -- cgit v1.2.3