aboutsummaryrefslogtreecommitdiffstats
path: root/spec/arel/table_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/arel/table_spec.rb')
-rw-r--r--spec/arel/table_spec.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/arel/table_spec.rb b/spec/arel/table_spec.rb
index be153438c4..b68fdd5a3d 100644
--- a/spec/arel/table_spec.rb
+++ b/spec/arel/table_spec.rb
@@ -6,6 +6,19 @@ module Arel
@relation = Table.new(:users)
end
+ describe 'where' do
+ it "returns a tree manager" do
+ manager = @relation.where @relation[:id].eq 1
+ manager.project @relation[:id]
+ manager.should be_kind_of TreeManager
+ manager.to_sql.should == %{
+ SELECT "users"."id"
+ FROM "users"
+ WHERE "users"."id" = 1
+ }.gsub("\n", '').gsub(/(^\s*|\s*$)/, '').squeeze(' ')
+ end
+ end
+
describe 'columns' do
it 'returns a list of columns' do
columns = @relation.columns