aboutsummaryrefslogtreecommitdiffstats
path: root/spec/arel/unit/predicates/binary_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/arel/unit/predicates/binary_spec.rb')
-rw-r--r--spec/arel/unit/predicates/binary_spec.rb17
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