diff options
author | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-05-17 23:03:56 -0700 |
---|---|---|
committer | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-05-17 23:03:56 -0700 |
commit | 6e1450a2a646e416aaea003eff19b7703c563bed (patch) | |
tree | 5caa324b2d33d1b48d7e440bf36fc9fe8efa5405 /spec/arel/unit/predicates | |
parent | 724a2684139342eb4613f78bfae723ef00911ff7 (diff) | |
download | rails-6e1450a2a646e416aaea003eff19b7703c563bed.tar.gz rails-6e1450a2a646e416aaea003eff19b7703c563bed.tar.bz2 rails-6e1450a2a646e416aaea003eff19b7703c563bed.zip |
performance enhancements
Diffstat (limited to 'spec/arel/unit/predicates')
-rw-r--r-- | spec/arel/unit/predicates/binary_spec.rb | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/spec/arel/unit/predicates/binary_spec.rb b/spec/arel/unit/predicates/binary_spec.rb index f39b37d913..2d6ef5d7e3 100644 --- a/spec/arel/unit/predicates/binary_spec.rb +++ b/spec/arel/unit/predicates/binary_spec.rb @@ -59,12 +59,21 @@ module Arel describe '#bind' do before do - @another_relation = Table.new(:photos) + @another_relation = @relation.alias end - it "descends" do - ConcreteBinary.new(@attribute1, @attribute2).bind(@another_relation). \ - should == ConcreteBinary.new(@attribute1.bind(@another_relation), @attribute2.bind(@another_relation)) + describe 'when both operands are attributes' do + it "manufactures an expression with the attributes bound to the relation" do + ConcreteBinary.new(@attribute1, @attribute2).bind(@another_relation). \ + should == ConcreteBinary.new(@another_relation[@attribute1], @another_relation[@attribute2]) + end + end + + describe 'when an operand is a value' do + it "manufactures an expression with unmodified values" do + ConcreteBinary.new(@attribute1, "asdf").bind(@another_relation). \ + should == ConcreteBinary.new(@another_relation[@attribute1], "asdf") + end end end end |