Sha256: 520ed68852f8063dd7e85e89b050ac09fc521f790bfa2f1e08ebcc5d416bafde

Contents?: true

Size: 692 Bytes

Versions: 24

Compression:

Stored size: 692 Bytes

Contents

require "spec_helper"

describe Mongoid::Matchers::Gt do

  describe "#matches?" do

    context "when the value is larger" do

      let(:matcher) { Mongoid::Matchers::Gt.new(5) }

      it "returns true" do
        matcher.matches?("$gte" => 3).should be_true
      end

    end

    context "when the value is smaller" do

      let(:matcher) { Mongoid::Matchers::Gt.new(5) }

      it "returns false" do
        matcher.matches?("$gte" => 10).should be_false
      end

    end

    context "when the value is nil" do

      let(:matcher) { Mongoid::Matchers::Gt.new(nil) }

      it "returns false" do
        matcher.matches?("$gte" => 5).should be_false
      end

    end

  end

end

Version data entries

24 entries across 24 versions & 3 rubygems

Version Path
mongoid-1.1.3 spec/unit/mongoid/matchers/gt_spec.rb
mongoid-1.1.2 spec/unit/mongoid/matchers/gt_spec.rb
mongoid-1.1.1 spec/unit/mongoid/matchers/gt_spec.rb
mongoid-1.1.0 spec/unit/mongoid/matchers/gt_spec.rb