Sha256: 76eebf4e0ffce2677fda585388f45a00cd89542978de20f26ac285cad8a9772e

Contents?: true

Size: 884 Bytes

Versions: 2

Compression:

Stored size: 884 Bytes

Contents

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
      is_expected.to be_stored_in(database: 'db1', collection: 'mongoid_test_identities', client: 'secondary')
    end

    it 'should delegate 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 & 2 rubygems

Version Path
omniauth-identity-2.0.0 spec/omniauth/identity/models/mongoid_spec.rb
omniauth-identity2-2.0 spec/omniauth/identity/models/mongoid_spec.rb