Skip to content

Commit

Permalink
Merge pull request #20 from treasure-data/add-TaskMonitorHook-spec
Browse files Browse the repository at this point in the history
Add specs for TaskMonitorHook
  • Loading branch information
nurse committed Feb 23, 2016
2 parents ebadf99 + d7c88cf commit 6c8cf5d
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions spec/task_monitor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,33 @@
end
end
end

describe PerfectQueue::TaskMonitorHook do
let (:task_monitor) do
tm = PerfectQueue::TaskMonitor.new(logger: double('logger').as_null_object)
end
let (:task) do
obj = double('task', key: 'foo', finish!: 1, release!: 1, retry!: 1, cancel_request!: 1, update_data!: 1)
obj.extend(TaskMonitorHook)
obj.instance_variable_set(:@log, double('log', info: nil))
obj.instance_variable_set(:@task_monitor, task_monitor)
obj
end
before do
end
describe 'finish!' do
it { task.finish! }
end
describe 'release!' do
it { task.release! }
end
describe 'retry!' do
it { task.retry! }
end
describe 'cancel_request!' do
it { task.cancel_request! }
end
describe 'update_data!' do
it { task.update_data!(double) }
end
end

0 comments on commit 6c8cf5d

Please sign in to comment.