aboutsummaryrefslogtreecommitdiffstats
path: root/spec/arel/algebra/unit/predicates/binary_spec.rb
diff options
context:
space:
mode:
authorBryan Helmkamp <bryan@brynary.com>2009-09-30 23:32:05 -0400
committerBryan Helmkamp <bryan@brynary.com>2009-09-30 23:32:05 -0400
commitbcd8ffa2183a1ca98417fb39bbd83e8f69c984c8 (patch)
tree36eac8c0fdd0a6a126a10dd7ad829401793a9379 /spec/arel/algebra/unit/predicates/binary_spec.rb
parent52e8aff146c162986566d3e03852395729d7c24d (diff)
downloadrails-bcd8ffa2183a1ca98417fb39bbd83e8f69c984c8.tar.gz
rails-bcd8ffa2183a1ca98417fb39bbd83e8f69c984c8.tar.bz2
rails-bcd8ffa2183a1ca98417fb39bbd83e8f69c984c8.zip
Create Predicates module to match directory structure
Diffstat (limited to 'spec/arel/algebra/unit/predicates/binary_spec.rb')
-rw-r--r--spec/arel/algebra/unit/predicates/binary_spec.rb42
1 files changed, 22 insertions, 20 deletions
diff --git a/spec/arel/algebra/unit/predicates/binary_spec.rb b/spec/arel/algebra/unit/predicates/binary_spec.rb
index 97ef098e0e..be4c1ac738 100644
--- a/spec/arel/algebra/unit/predicates/binary_spec.rb
+++ b/spec/arel/algebra/unit/predicates/binary_spec.rb
@@ -1,31 +1,33 @@
require 'spec_helper'
module Arel
- describe Binary do
- before do
- @relation = Table.new(:users)
- @attribute1 = @relation[:id]
- @attribute2 = @relation[:name]
- class ConcreteBinary < Binary
- end
- end
-
- describe '#bind' do
+ module Predicates
+ describe Binary do
before do
- @another_relation = @relation.alias
+ @relation = Table.new(:users)
+ @attribute1 = @relation[:id]
+ @attribute2 = @relation[:name]
+ class ConcreteBinary < Binary
+ end
end
- 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])
+ describe '#bind' do
+ before do
+ @another_relation = @relation.alias
+ end
+
+ 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
- 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(@attribute1.find_correlate_in(@another_relation), "asdf".find_correlate_in(@another_relation))
+ 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(@attribute1.find_correlate_in(@another_relation), "asdf".find_correlate_in(@another_relation))
+ end
end
end
end