闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
497 B

  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