Sha256: f025932e5dffc3dc64bb516a8dc69fc3b0ebbcb8722bb71c4f689c75c358df0d

Contents?: true

Size: 745 Bytes

Versions: 4

Compression:

Stored size: 745 Bytes

Contents

describe Casino::Intersection::Match::Include do

  let(:system) { Casino::Intersection::Match::Include }

  describe '#eligible?' do
    describe 'when the key is $in' do
      let(:matcher) { system.new('$in', '', '', '') }
      subject { matcher.eligible? }
      it { subject.must_equal true }
    end
  end

  describe '#evaluate' do
    describe 'when the value is within the field' do
      let(:matcher) { system.new('$in', 1, '', [1, 2, 3, 4]) }
      subject { matcher.evaluate }
      it { subject.must_equal true }
    end

    describe 'when the value is not within the field' do
      let(:matcher) { system.new('$in', 1, '', [2, 3, 4]) }
      subject { matcher.evaluate }
      it { subject.must_equal false }
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mongoid-casino-0.0.4 spec/lib/casino/intersection/match/include_spec.rb
mongoid-casino-0.0.3 spec/lib/casino/intersection/match/include_spec.rb
mongoid-casino-0.0.2 spec/lib/casino/intersection/match/include_spec.rb
mongoid-casino-0.0.1 spec/lib/casino/intersection/match/include_spec.rb