Skip to content

Commit

Permalink
improve test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Berube committed May 4, 2015
1 parent 852322d commit 7748576
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions spec/lib/sidekiq_testing_enabled_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,33 @@
expect(UniqueWorker.jobs.size).to eq(1)
end

it 'unlocks a job after draining a worker' do
it 'unlocks jobs after draining a worker' do
param = 'work'
param2 = 'more work'
expect(UniqueWorker.jobs.size).to eq(0)
UniqueWorker.perform_async(param)
expect(UniqueWorker.jobs.size).to eq(1)
UniqueWorker.perform_async(param2)
expect(UniqueWorker.jobs.size).to eq(2)
UniqueWorker.drain
expect(UniqueWorker.jobs.size).to eq(0)
UniqueWorker.perform_async(param)
UniqueWorker.perform_async(param2)
expect(UniqueWorker.jobs.size).to eq(2)
end

it 'unlocks a single job when calling perform_one' do
param = 'work'
param2 = 'more work'
expect(UniqueWorker.jobs.size).to eq(0)
UniqueWorker.perform_async(param)
UniqueWorker.perform_async(param2)
expect(UniqueWorker.jobs.size).to eq(2)
UniqueWorker.perform_one
expect(UniqueWorker.jobs.size).to eq(1)
UniqueWorker.perform_async(param2)
expect(UniqueWorker.jobs.size).to eq(1)
UniqueWorker.perform_async(param)
expect(UniqueWorker.jobs.size).to eq(2)
end

it 'unlocks jobs cleared from a single worker' do
Expand Down

0 comments on commit 7748576

Please sign in to comment.