Skip to content

Commit

Permalink
Add test for multiple callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
quirkey committed Oct 3, 2011
1 parent 48b153f commit 3e6e003
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/test_resque-metrics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,20 @@ def test_should_record_avg_job_time

def test_should_call_callbacks
recorded = []
recorded_count = 0
Resque::Metrics.on_job do |klass, queue, time|
recorded << [klass, queue, time]
end
Resque::Metrics.on_job do |klass, queue, time|
recorded_count += 1
end
work_job
work_job
assert_equal 2, recorded.length
assert_equal SomeJob, recorded[0][0]
assert_equal :jobs, recorded[0][1]
assert recorded[0][2] > 0
assert_equal 2, recorded_count
end

private
Expand Down

0 comments on commit 3e6e003

Please sign in to comment.