spec/symbol_operator_spec.rb in plucky-0.6.3 vs spec/symbol_operator_spec.rb in plucky-0.6.4
- old
+ new
@@ -32,10 +32,27 @@
it "returns false if other isn't an symbol operator" do
SymbolOperator.new(:foo, 'in').should_not == 'foo.in'
end
end
-
+
+ context "hash" do
+
+ it 'returns sum of operator and hash field' do
+ SymbolOperator.new(:foo, 'in').hash.should == :foo.hash + 'in'.hash
+ end
+
+ end
+
+ context 'eql?' do
+
+ it 'uses #== for equality comparison' do
+ subject.should_receive(:"==").with("dummy_value")
+ subject.eql?("dummy_value")
+ end
+
+ end
+
context "<=>" do
it "returns string comparison of operator for same field, different operator" do
(SymbolOperator.new(:foo, 'in') <=> SymbolOperator.new(:foo, 'all')).should == 1
(SymbolOperator.new(:foo, 'all') <=> SymbolOperator.new(:foo, 'in')).should == -1
end