Welcome to mirror list, hosted at ThFree Co, Russian Federation.

remove_empty_extern_uid_auth0_identities_spec.rb « migrations « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 441c4295a4055fc48a31bc7fb2a09df6787e6f11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require 'spec_helper'
require Rails.root.join('db', 'post_migrate', '20180220150310_remove_empty_extern_uid_auth0_identities.rb')

describe RemoveEmptyExternUidAuth0Identities, :migration do
  let(:identities) { table(:identities) }

  before do
    identities.create(provider: 'auth0', extern_uid: '')
    identities.create(provider: 'auth0', extern_uid: 'valid')
    identities.create(provider: 'github', extern_uid: '')

    migrate!
  end

  it 'leaves the correct auth0 identity' do
    expect(identities.where(provider: 'auth0').pluck(:extern_uid)).to eq(['valid'])
  end

  it 'leaves the correct github identity' do
    expect(identities.where(provider: 'github').count).to eq(1)
  end
end