debian-mirror-gitlab/spec/migrations/rename_users_with_renamed_namespace_spec.rb

23 lines
992 B
Ruby
Raw Normal View History

2017-08-17 22:00:37 +05:30
require 'spec_helper'
require Rails.root.join('db', 'post_migrate', '20170518200835_rename_users_with_renamed_namespace.rb')
2018-03-17 18:26:18 +05:30
describe RenameUsersWithRenamedNamespace, :delete do
2017-08-17 22:00:37 +05:30
it 'renames a user that had their namespace renamed to the namespace path' do
2018-05-09 12:01:36 +05:30
other_user = create(:user, username: 'kodingu') # rubocop:disable RSpec/FactoriesInMigrationSpecs
other_user1 = create(:user, username: 'api0') # rubocop:disable RSpec/FactoriesInMigrationSpecs
2017-08-17 22:00:37 +05:30
2018-05-09 12:01:36 +05:30
user = create(:user, username: "Users0") # rubocop:disable RSpec/FactoriesInMigrationSpecs
user.update_column(:username, 'Users')
user1 = create(:user, username: "import0") # rubocop:disable RSpec/FactoriesInMigrationSpecs
user1.update_column(:username, 'import')
2017-08-17 22:00:37 +05:30
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