2017-05-18 17:31:03 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
require Rails.root.join('db', 'post_migrate', '20170518200835_rename_users_with_renamed_namespace.rb')
|
|
|
|
|
|
|
|
describe RenameUsersWithRenamedNamespace, truncate: true do
|
2017-05-19 11:22:45 -04:00
|
|
|
it 'renames a user that had their namespace renamed to the namespace path' do
|
2017-05-18 17:31:03 -04:00
|
|
|
other_user = create(:user, username: 'kodingu')
|
2017-05-19 11:22:45 -04:00
|
|
|
other_user1 = create(:user, username: 'api0')
|
2017-05-18 17:31:03 -04:00
|
|
|
|
|
|
|
user = create(:user, username: "Users0")
|
|
|
|
user.update_attribute(:username, 'Users')
|
|
|
|
user1 = create(:user, username: "import0")
|
|
|
|
user1.update_attribute(:username, 'import')
|
|
|
|
|
|
|
|
described_class.new.up
|
|
|
|
|
|
|
|
expect(user.reload.username).to eq('Users0')
|
|
|
|
expect(user1.reload.username).to eq('import0')
|
2017-05-19 11:22:45 -04:00
|
|
|
|
2017-05-18 17:31:03 -04:00
|
|
|
expect(other_user.reload.username).to eq('kodingu')
|
2017-05-19 11:22:45 -04:00
|
|
|
expect(other_user1.reload.username).to eq('api0')
|
2017-05-18 17:31:03 -04:00
|
|
|
end
|
|
|
|
end
|