diff options
author | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2007-12-30 17:35:23 -0800 |
---|---|---|
committer | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2007-12-30 17:35:23 -0800 |
commit | 1a59c8cbc90d37fa571c12049d0e43aa44d46388 (patch) | |
tree | 021bcf5e92274cfcbbd43541b1ab4e57a6a8275e /spec | |
parent | 63b9c6a41f7ab92a16362a50b60bcea7e20cb427 (diff) | |
download | rails-1a59c8cbc90d37fa571c12049d0e43aa44d46388.tar.gz rails-1a59c8cbc90d37fa571c12049d0e43aa44d46388.tar.bz2 rails-1a59c8cbc90d37fa571c12049d0e43aa44d46388.zip |
sql builder
Diffstat (limited to 'spec')
-rw-r--r-- | spec/relations/table_relation_spec.rb | 5 | ||||
-rw-r--r-- | spec/spec_helper.rb | 7 | ||||
-rw-r--r-- | spec/sql/select_spec.rb | 19 |
3 files changed, 10 insertions, 21 deletions
diff --git a/spec/relations/table_relation_spec.rb b/spec/relations/table_relation_spec.rb index dd86f83294..a0647aa541 100644 --- a/spec/relations/table_relation_spec.rb +++ b/spec/relations/table_relation_spec.rb @@ -2,6 +2,9 @@ require File.join(File.dirname(__FILE__), '..', 'spec_helper') describe TableRelation, '#to_sql' do it "returns a simple SELECT query" do - TableRelation.new(:users).to_sql.should == Select.new(:*).from(:users) + TableRelation.new(:users).to_sql.should == SelectBuilder.new do |s| + select :* + from :users + end end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 30c1f65f57..a764fff03e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,8 @@ require 'rubygems' require 'spec' -require File.join(File.dirname(__FILE__), '..', 'lib', 'sql_algebra')
\ No newline at end of file +require File.join(File.dirname(__FILE__), '..', 'lib', 'sql_algebra') +require File.join(File.dirname(__FILE__), 'spec_helpers', 'be_like') + +Spec::Runner.configure do |config| + config.include(BeLikeMatcher) +end
\ No newline at end of file diff --git a/spec/sql/select_spec.rb b/spec/sql/select_spec.rb deleted file mode 100644 index 7d40a20a5b..0000000000 --- a/spec/sql/select_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -require File.join(File.dirname(__FILE__), '..', 'spec_helper') - -describe Select, '==' do - it "obtains for queries with identical attributes" do - Select.new(:foo).should == Select.new(:foo) - Select.new(:bar).should_not == Select.new(:foo) - end - - it "obtains for queries with identical tables" do - Select.new(:foo).from(:bar).should == Select.new(:foo).from(:bar) - Select.new(:foo).from(:bar).should_not == Select.new(:foo).from(:foo) - end - - it "obtains for queries with identical predicates" do - Select.new(:foo).from(:bar).where(:baz).should == Select.new(:foo).from(:bar).where(:baz) - Select.new(:foo).from(:bar).where(:baz).should_not == Select.new(:foo).from(:bar).where(:foo) - end - -end
\ No newline at end of file |