spec/seam/worker_spec.rb in seam-0.0.5 vs spec/seam/worker_spec.rb in seam-0.0.6

- old
+ new

@@ -20,11 +20,11 @@ effort = Seam::Effort.find(effort.id) effort.next_step.must_equal "apple" apple_worker = Seam::Worker.new - apple_worker.for(:apple) + apple_worker.handles(:apple) def apple_worker.process move_to_next_step end apple_worker.execute effort @@ -48,11 +48,11 @@ before do Timecop.freeze Time.parse('3/4/2013') effort.next_step.must_equal "apple" apple_worker = Seam::Worker.new - apple_worker.for(:apple) + apple_worker.handles(:apple) def apple_worker.process try_again_in 1.day end apple_worker.execute effort @@ -91,11 +91,11 @@ before do Timecop.freeze Time.parse('1/6/2013') apple_worker = Seam::Worker.new - apple_worker.for(:apple) + apple_worker.handles(:apple) def apple_worker.process if @current_effort.data[:status] == 'Good' move_to_next_step else try_again_in 1.day @@ -141,11 +141,11 @@ end end let(:apple_worker) do apple_worker = Seam::Worker.new - apple_worker.for(:apple) + apple_worker.handles(:apple) apple_worker.class_eval do attr_accessor :count end @@ -191,11 +191,11 @@ end end let(:wait_for_attempting_contact_stage_worker) do worker = Seam::Worker.new - worker.for(:wait_for_attempting_contact_stage) + worker.handles(:wait_for_attempting_contact_stage) def worker.process @current_effort.data['hit 1'] ||= 0 @current_effort.data['hit 1'] += 1 move_to_next_step @@ -204,11 +204,11 @@ worker end let(:determine_if_postcard_should_be_sent_worker) do worker = Seam::Worker.new - worker.for(:determine_if_postcard_should_be_sent) + worker.handles(:determine_if_postcard_should_be_sent) def worker.process @current_effort.data['hit 2'] ||= 0 @current_effort.data['hit 2'] += 1 move_to_next_step @@ -217,11 +217,11 @@ worker end let(:send_postcard_if_necessary_worker) do worker = Seam::Worker.new - worker.for(:send_postcard_if_necessary) + worker.handles(:send_postcard_if_necessary) def worker.process @current_effort.data['hit 3'] ||= 0 @current_effort.data['hit 3'] += 1 move_to_next_step @@ -310,11 +310,11 @@ end end let(:wait_for_attempting_contact_stage_worker) do worker = Seam::Worker.new - worker.for(:wait_for_attempting_contact_stage) + worker.handles(:wait_for_attempting_contact_stage) def worker.process @current_effort.data['hit 1'] ||= 0 @current_effort.data['hit 1'] += 1 if Time.now >= Time.parse('28/12/2013') @@ -327,11 +327,11 @@ worker end let(:determine_if_postcard_should_be_sent_worker) do worker = Seam::Worker.new - worker.for(:determine_if_postcard_should_be_sent) + worker.handles(:determine_if_postcard_should_be_sent) def worker.process @current_effort.data['hit 2'] ||= 0 @current_effort.data['hit 2'] += 1 move_to_next_step @@ -340,11 +340,11 @@ worker end let(:send_postcard_if_necessary_worker) do worker = Seam::Worker.new - worker.for(:send_postcard_if_necessary) + worker.handles(:send_postcard_if_necessary) def worker.process @current_effort.data['hit 3'] ||= 0 @current_effort.data['hit 3'] += 1 move_to_next_step @@ -410,11 +410,11 @@ end end let(:wait_for_attempting_contact_stage_worker) do worker = Seam::Worker.new - worker.for(:wait_for_attempting_contact_stage) + worker.handles(:wait_for_attempting_contact_stage) def worker.process @current_effort.data['hit 1'] ||= 0 @current_effort.data['hit 1'] += 1 if Time.now >= Time.parse('28/12/2013') @@ -427,11 +427,11 @@ worker end let(:determine_if_postcard_should_be_sent_worker) do worker = Seam::Worker.new - worker.for(:determine_if_postcard_should_be_sent) + worker.handles(:determine_if_postcard_should_be_sent) def worker.process @current_effort.data['hit 2'] ||= 0 @current_effort.data['hit 2'] += 1 move_to_next_step @@ -440,11 +440,11 @@ worker end let(:send_postcard_if_necessary_worker) do worker = Seam::Worker.new - worker.for(:send_postcard_if_necessary) + worker.handles(:send_postcard_if_necessary) def worker.process @current_effort.data['hit 3'] ||= 0 @current_effort.data['hit 3'] += 1 move_to_next_step @@ -555,10 +555,10 @@ before do Timecop.freeze Time.parse('5/11/2013') effort.next_step.must_equal "apple" apple_worker = Seam::Worker.new - apple_worker.for(:apple) + apple_worker.handles(:apple) def apple_worker.process eject end apple_worker.execute effort