Skip to content
Snippets Groups Projects
Commit de9b9b71 authored by Toon Claes's avatar Toon Claes
Browse files

Make it only run the associated migration

parent 05abfa07
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -18,33 +18,33 @@ describe MigrateIssuesToGhostUser, :migration do
let!(:ghost) { users.create(ghost: true, email: 'ghost@example.com') }
 
it 'does not create a new user' do
expect { schema_migrate_up! }.not_to change { User.count }
expect { migrate! }.not_to change { User.count }
end
 
it 'migrates issues where author = nil to the ghost user' do
schema_migrate_up!
migrate!
 
expect(issues.first.reload.author_id).to eq(ghost.id)
end
 
it 'does not change issues authored by an existing user' do
expect { schema_migrate_up! }.not_to change { issues.second.reload.author_id}
expect { migrate! }.not_to change { issues.second.reload.author_id}
end
end
 
context 'when ghost user does not exist' do
it 'creates a new user' do
expect { schema_migrate_up! }.to change { User.count }.by(1)
expect { migrate! }.to change { User.count }.by(1)
end
 
it 'migrates issues where author = nil to the ghost user' do
schema_migrate_up!
migrate!
 
expect(issues.first.reload.author_id).to eq(User.ghost.id)
end
 
it 'does not change issues authored by an existing user' do
expect { schema_migrate_up! }.not_to change { issues.second.reload.author_id}
expect { migrate! }.not_to change { issues.second.reload.author_id}
end
end
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment