aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-08-06 11:30:53 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-08-06 11:30:53 -0700
commit389c4fc2582ae42c32a20b7f6a6cb2c5680343fc (patch)
tree56dfaf57a4eecc052cb29ba3e3d0d95973304b64
parent21267d3c59457141e6dd6e47ba290df2cd583866 (diff)
downloadrails-389c4fc2582ae42c32a20b7f6a6cb2c5680343fc.tar.gz
rails-389c4fc2582ae42c32a20b7f6a6cb2c5680343fc.tar.bz2
rails-389c4fc2582ae42c32a20b7f6a6cb2c5680343fc.zip
add an operator to inequality
-rw-r--r--lib/arel/algebra/predicates.rb1
-rw-r--r--spec/algebra/unit/predicates/inequality_spec.rb6
2 files changed, 7 insertions, 0 deletions
diff --git a/lib/arel/algebra/predicates.rb b/lib/arel/algebra/predicates.rb
index 9764c4cfa2..e9fb51d889 100644
--- a/lib/arel/algebra/predicates.rb
+++ b/lib/arel/algebra/predicates.rb
@@ -197,6 +197,7 @@ module Arel
Equality.new(operand1, operand2)
end
+ def operator; :"!=" end
def eval(row)
operand1.eval(row) != operand2.eval(row)
end
diff --git a/spec/algebra/unit/predicates/inequality_spec.rb b/spec/algebra/unit/predicates/inequality_spec.rb
index 557494e2cd..f95b8d120e 100644
--- a/spec/algebra/unit/predicates/inequality_spec.rb
+++ b/spec/algebra/unit/predicates/inequality_spec.rb
@@ -12,6 +12,12 @@ module Arel
@b = Inequality.new(right, left)
end
+ describe 'operator' do
+ it "should have one" do
+ @a.operator.should == :"!="
+ end
+ end
+
describe '==' do
it "is equal to itself" do
@a.should == @a