identity_spec.rb 497 B

12345678910111213141516
  1. require 'rails_helper'
  2. RSpec.describe Identity, type: :model do
  3. describe '.find_for_oauth' do
  4. let(:auth) { Fabricate(:identity, user: Fabricate(:user)) }
  5. it 'calls .find_or_create_by' do
  6. expect(described_class).to receive(:find_or_create_by).with(uid: auth.uid, provider: auth.provider)
  7. described_class.find_for_oauth(auth)
  8. end
  9. it 'returns an instance of Identity' do
  10. expect(described_class.find_for_oauth(auth)).to be_instance_of Identity
  11. end
  12. end
  13. end