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.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/arel/unit/predicates/binary_spec.rb b/spec/arel/unit/predicates/binary_spec.rb
index 5dee4833d4..56fcf2d8ad 100644
--- a/spec/arel/unit/predicates/binary_spec.rb
+++ b/spec/arel/unit/predicates/binary_spec.rb
@@ -13,6 +13,33 @@ module Arel
end
end
+ describe "with compound predicates" do
+ before do
+ @operand1 = ConcreteBinary.new(@attribute1, 1)
+ @operand2 = ConcreteBinary.new(@attribute2, "name")
+ end
+
+ describe Or do
+ describe "#to_sql" do
+ it "manufactures sql with an OR operation" do
+ Or.new(@operand1, @operand2).to_sql.should be_like("
+ (`users`.`id` <=> 1 OR `users`.`name` <=> 'name')
+ ")
+ end
+ end
+ end
+
+ describe And do
+ describe "#to_sql" do
+ it "manufactures sql with an AND operation" do
+ And.new(@operand1, @operand2).to_sql.should be_like("
+ (`users`.`id` <=> 1 AND `users`.`name` <=> 'name')
+ ")
+ end
+ end
+ end
+ end
+
describe '#to_sql' do
describe 'when relating two attributes' do
it 'manufactures sql with a binary operation' do