Sha256: 3444f40d0a5979226ecd2dd918924d360b23a55658b53873c35b6c0872b23643

Contents?: true

Size: 872 Bytes

Versions: 11

Compression:

Stored size: 872 Bytes

Contents

require 'spec_helper'

module MongoModel
  describe MongoOperator do
    subject { MongoOperator.new(:age, :gt) }
  
    it "should convert to mongo selector" do
      subject.to_mongo_selector(14).should == { '$gt' => 14 }
    end
  
    it "should be equal to a MongoOperator with the same field and operator" do
      subject.should == MongoOperator.new(:age, :gt)
    end
  
    it "should not be equal to a MongoOperator with a different field/operator" do
      subject.should_not == MongoOperator.new(:age, :lte)
      subject.should_not == MongoOperator.new(:date, :gt)
    end
  
    it "should be created from symbol methods" do
      :age.gt.should == MongoOperator.new(:age, :gt)
      :date.lte.should == MongoOperator.new(:date, :lte)
    end
  
    it "should be equal within a hash" do
      { :age.gt => 10 }.should == { :age.gt => 10 }
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
mongomodel-0.2.10 spec/mongomodel/support/mongo_operator_spec.rb
mongomodel-0.2.9 spec/mongomodel/support/mongo_operator_spec.rb
mongomodel-0.2.8 spec/mongomodel/support/mongo_operator_spec.rb
mongomodel-0.2.7 spec/mongomodel/support/mongo_operator_spec.rb
mongomodel-0.2.6 spec/mongomodel/support/mongo_operator_spec.rb
mongomodel-0.2.5 spec/mongomodel/support/mongo_operator_spec.rb
mongomodel-0.2.4 spec/mongomodel/support/mongo_operator_spec.rb
mongomodel-0.2.3 spec/mongomodel/support/mongo_operator_spec.rb
mongomodel-0.2.2 spec/mongomodel/support/mongo_operator_spec.rb
mongomodel-0.2.1 spec/mongomodel/support/mongo_operator_spec.rb
mongomodel-0.2.0 spec/mongomodel/support/mongo_operator_spec.rb