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

rename_users_with_renamed_namespace_spec.rb « migrations « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e2994103ed742d4db42c3b5282c40eb01aed34d5 (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', '20170518200835_rename_users_with_renamed_namespace.rb')

describe RenameUsersWithRenamedNamespace, :delete do
  it 'renames a user that had their namespace renamed to the namespace path' do
    other_user = create(:user, username: 'kodingu')
    other_user1 = create(:user, username: 'api0')

    user = create(:user, username: "Users0")
    user.update_column(:username, 'Users')
    user1 = create(:user, username: "import0")
    user1.update_column(:username, 'import')

    described_class.new.up

    expect(user.reload.username).to eq('Users0')
    expect(user1.reload.username).to eq('import0')

    expect(other_user.reload.username).to eq('kodingu')
    expect(other_user1.reload.username).to eq('api0')
  end
end