Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Clean up priority spec

  • Loading branch information...
commit 736992310e6000d2da2be8f4693704919ba3fac2 1 parent 757a614
Brandon Keepers bkeepers authored

Showing 1 changed file with 5 additions and 10 deletions. Show diff stats Hide diff stats

  1. +5 10 spec/shared_backend_spec.rb
15 spec/shared_backend_spec.rb
@@ -183,17 +183,12 @@ def create_job(opts = {})
183 183 end
184 184
185 185 it "should fetch jobs ordered by priority" do
186   - number_of_jobs = 10
187   - number_of_jobs.times { @backend.enqueue SimpleJob.new, rand(10) }
  186 + 10.times { @backend.enqueue SimpleJob.new, rand(10) }
188 187 jobs = @backend.find_available('worker', 10)
189   - ordered = true
190   - jobs[1..-1].each_index{ |i|
191   - if (jobs[i].priority > jobs[i+1].priority)
192   - ordered = false
193   - break
194   - end
195   - }
196   - ordered.should == true
  188 + jobs.size.should == 10
  189 + jobs.each_cons(2) do |a, b|
  190 + a.priority.should <= b.priority
  191 + end
197 192 end
198 193 end
199 194

0 comments on commit 7369923

Please sign in to comment.
Something went wrong with that request. Please try again.