1
0

identity_spec.rb 598 B

123456789101112131415161718192021
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe Identity do
  4. describe '.find_for_omniauth' do
  5. let(:auth) { Fabricate(:identity, user: Fabricate(:user)) }
  6. it 'calls .find_or_create_by' do
  7. allow(described_class).to receive(:find_or_create_by)
  8. described_class.find_for_omniauth(auth)
  9. expect(described_class).to have_received(:find_or_create_by).with(uid: auth.uid, provider: auth.provider)
  10. end
  11. it 'returns an instance of Identity' do
  12. expect(described_class.find_for_omniauth(auth)).to be_instance_of described_class
  13. end
  14. end
  15. end