Sha256: 4f9aca9a99cec9917355cf5d1bf2c659408a380f6799e4858166013443ed4e26

Contents?: true

Size: 930 Bytes

Versions: 2

Compression:

Stored size: 930 Bytes

Contents

RSpec.describe(OmniAuth::Identity::Models::Mongoid, db: true) do
  class MongoidTestIdentity
    include Mongoid::Document
    include OmniAuth::Identity::Models::Mongoid
    auth_key :ham_sandwich
    store_in database: 'db1', collection: 'mongoid_test_identities', client: 'secondary'
  end

  describe 'model', type: :model do
    subject { MongoidTestIdentity }

    it { is_expected.to be_mongoid_document }

    it 'does not munge collection name' do
      expect(subject).to be_stored_in(database: 'db1', collection: 'mongoid_test_identities', client: 'secondary')
    end

    it 'delegates locate to the where query method' do
      allow(subject).to receive(:where).with('ham_sandwich' => 'open faced',
                                             'category' => 'sandwiches').and_return(['wakka'])
      expect(subject.locate('ham_sandwich' => 'open faced', 'category' => 'sandwiches')).to eq('wakka')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
omniauth-identity-3.0.1 spec/omniauth/identity/models/mongoid_spec.rb
omniauth-identity-3.0.0 spec/omniauth/identity/models/mongoid_spec.rb