From d827d6e9ee10fa0906b7b3cfd191e6f9ac5d6b08 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Thu, 12 Aug 2010 15:40:58 -0700 Subject: to_sql visitor started --- spec/arel/attributes/attribute_spec.rb | 10 ++++++++++ spec/arel/table_spec.rb | 8 ++++++++ 2 files changed, 18 insertions(+) (limited to 'spec') diff --git a/spec/arel/attributes/attribute_spec.rb b/spec/arel/attributes/attribute_spec.rb index 5599bb7b51..ef0e0787fa 100644 --- a/spec/arel/attributes/attribute_spec.rb +++ b/spec/arel/attributes/attribute_spec.rb @@ -13,5 +13,15 @@ module Arel end end end + + describe 'equality' do + describe '#to_sql' do + it 'should produce sql' do + table = Table.new :users + condition = table['id'].eq 1 + condition.to_sql.should == '"users"."id" = 1' + end + end + end end end diff --git a/spec/arel/table_spec.rb b/spec/arel/table_spec.rb index c52a111489..be153438c4 100644 --- a/spec/arel/table_spec.rb +++ b/spec/arel/table_spec.rb @@ -14,6 +14,14 @@ module Arel end end + it "should have a name" do + @relation.name.should == :users + end + + it "should have an engine" do + @relation.engine.should == Table.engine + end + describe '[]' do describe 'when given a', Symbol do it "manufactures an attribute if the symbol names an attribute within the relation" do -- cgit v1.2.3