diff options
Diffstat (limited to 'spec/lib/gitlab/background_migration_spec.rb')
-rw-r--r-- | spec/lib/gitlab/background_migration_spec.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/spec/lib/gitlab/background_migration_spec.rb b/spec/lib/gitlab/background_migration_spec.rb index 2f3e7aba1f4..c12040cba14 100644 --- a/spec/lib/gitlab/background_migration_spec.rb +++ b/spec/lib/gitlab/background_migration_spec.rb @@ -23,13 +23,21 @@ describe Gitlab::BackgroundMigration do end it 'steals jobs from a queue' do - expect(queue[0]).to receive(:delete) + expect(queue[0]).to receive(:delete).and_return(true) expect(described_class).to receive(:perform).with('Foo', [10, 20]) described_class.steal('Foo') end + it 'does not steal job that has already been taken' do + expect(queue[0]).to receive(:delete).and_return(false) + + expect(described_class).not_to receive(:perform).with('Foo', [10, 20]) + + described_class.steal('Foo') + end + it 'does not steal jobs for a different migration' do expect(described_class).not_to receive(:perform) |