Sha256: f16c9fdd32ffb6c72f588bb86433c14e91d1e900ac4526a1d3299518609575c7
Contents?: true
Size: 1.12 KB
Versions: 3
Compression:
Stored size: 1.12 KB
Contents
require "spec_helper" describe Mongoid::Matchers::Exists do describe "#matches?" do context "when checking for existence" do context "when the value exists" do let(:matcher) do described_class.new("Test") end it "returns true" do matcher.matches?("$exists" => true).should be_true end end context "when the value does not exist" do let(:matcher) do described_class.new(nil) end it "returns false" do matcher.matches?("$exists" => true).should be_false end end end context "when checking for nonexistence" do context "when the value exists" do let(:matcher) do described_class.new("Test") end it "returns false" do matcher.matches?("$exists" => false).should be_false end end context "when the value does not exist" do let(:matcher) do described_class.new(nil) end it "returns true" do matcher.matches?("$exists" => false).should be_true end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mongoid-3.1.7 | spec/mongoid/matchers/exists_spec.rb |
mongoid-3.1.6 | spec/mongoid/matchers/exists_spec.rb |
mongoid-3.1.5 | spec/mongoid/matchers/exists_spec.rb |