Sha256: 85634113176ace9efa0f546ddeb7871738661b5c4e5359d6901859d71b546e03

Contents?: true

Size: 799 Bytes

Versions: 27

Compression:

Stored size: 799 Bytes

Contents

# frozen_string_literal: true

shared_examples_for "returns a cloned query" do

  it "returns a cloned query" do
    expect(selection).to_not equal(query)
  end
end

shared_examples_for 'requires an argument' do
  context "when provided no argument" do

    let(:selection) do
      query.send(query_method)
    end

    it "raises ArgumentError" do
      expect do
        selection.selector
      end.to raise_error(ArgumentError)
    end
  end
end

shared_examples_for 'requires a non-nil argument' do
  context "when provided nil" do

    let(:selection) do
      query.send(query_method, nil)
    end

    it "raises CriteriaArgumentRequired" do
      expect do
        selection.selector
      end.to raise_error(Mongoid::Errors::CriteriaArgumentRequired, /#{query_method}/)
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
mongoid-8.1.9 spec/mongoid/criteria/queryable/selectable_shared_examples.rb
mongoid-8.0.9 spec/mongoid/criteria/queryable/selectable_shared_examples.rb
mongoid-8.1.8 spec/mongoid/criteria/queryable/selectable_shared_examples.rb
mongoid-8.1.7 spec/mongoid/criteria/queryable/selectable_shared_examples.rb
mongoid-8.1.6 spec/mongoid/criteria/queryable/selectable_shared_examples.rb
mongoid-8.0.8 spec/mongoid/criteria/queryable/selectable_shared_examples.rb
mongoid-8.1.5 spec/mongoid/criteria/queryable/selectable_shared_examples.rb
mongoid-8.1.4 spec/mongoid/criteria/queryable/selectable_shared_examples.rb
mongoid-8.0.7 spec/mongoid/criteria/queryable/selectable_shared_examples.rb
mongoid-8.1.3 spec/mongoid/criteria/queryable/selectable_shared_examples.rb
mongoid-8.1.2 spec/mongoid/criteria/queryable/selectable_shared_examples.rb
mongoid-8.0.6 spec/mongoid/criteria/queryable/selectable_shared_examples.rb
mongoid-7.5.4 spec/mongoid/criteria/queryable/selectable_shared_examples.rb
mongoid-8.1.1 spec/mongoid/criteria/queryable/selectable_shared_examples.rb
mongoid-8.0.5 spec/mongoid/criteria/queryable/selectable_shared_examples.rb
mongoid-8.1.0 spec/mongoid/criteria/queryable/selectable_shared_examples.rb
mongoid-7.5.3 spec/mongoid/criteria/queryable/selectable_shared_examples.rb
mongoid-8.0.4 spec/mongoid/criteria/queryable/selectable_shared_examples.rb
mongoid-8.0.3 spec/mongoid/criteria/queryable/selectable_shared_examples.rb
mongoid-7.5.2 spec/mongoid/criteria/queryable/selectable_shared_examples.rb