spec/seam/worker_spec.rb in seam-0.0.17 vs spec/seam/worker_spec.rb in seam-0.0.18

- old
+ new

@@ -603,10 +603,11 @@ effort = Seam::Effort.find effort.id effort.next_step.must_equal "wait_for_attempting_contact_stage" effort.history.count.must_equal 1 effort.history[0].contrast_with!( { + "step_id" => effort.flow['steps'][0]['id'], "started_at"=> Time.now, "step"=>"wait_for_attempting_contact_stage", "stopped_at" => Time.now, } ) @@ -619,11 +620,18 @@ effort = Seam::Effort.find effort.id effort.next_step.must_equal "wait_for_attempting_contact_stage" effort.history.count.must_equal 1 - effort.history[0].contrast_with!({"started_at"=> Time.now, "step"=>"wait_for_attempting_contact_stage", "stopped_at" => Time.now, "result" => "try_again_in", "try_again_on" => Time.now + 1.day } ) + effort.history[0].contrast_with!( { + "step_id" => effort.flow['steps'][0]['id'], + "started_at"=> Time.now, + "step"=>"wait_for_attempting_contact_stage", + "stopped_at" => Time.now, + "result" => "try_again_in", + "try_again_on" => Time.now + 1.day + } ) # THE NEXT DAY Timecop.freeze Time.parse('27/12/2013') send_postcard_if_necessary_worker.execute_all @@ -632,11 +640,17 @@ effort = Seam::Effort.find effort.id effort.next_step.must_equal "wait_for_attempting_contact_stage" effort.history.count.must_equal 2 - effort.history[1].contrast_with!({"started_at"=> Time.now, "step"=>"wait_for_attempting_contact_stage", "stopped_at" => Time.now, "result" => "try_again_in" } ) + effort.history[1].contrast_with!( { + "step_id" => effort.flow['steps'][0]['id'], + "started_at"=> Time.now, + "step"=>"wait_for_attempting_contact_stage", + "stopped_at" => Time.now, + "result" => "try_again_in" + } ) # THE NEXT DAY Timecop.freeze Time.parse('28/12/2013') send_postcard_if_necessary_worker.execute_all @@ -645,30 +659,48 @@ effort = Seam::Effort.find effort.id effort.next_step.must_equal "determine_if_postcard_should_be_sent" effort.history.count.must_equal 3 - effort.history[2].contrast_with!({"started_at"=> Time.now, "step"=>"wait_for_attempting_contact_stage", "stopped_at" => Time.now, "result" => "move_to_next_step" } ) + effort.history[2].contrast_with!( { + "step_id" => effort.flow['steps'][0]['id'], + "started_at"=> Time.now, + "step"=>"wait_for_attempting_contact_stage", + "stopped_at" => Time.now, + "result" => "move_to_next_step" + } ) # KEEP GOING send_postcard_if_necessary_worker.execute_all determine_if_postcard_should_be_sent_worker.execute_all wait_for_attempting_contact_stage_worker.execute_all effort = Seam::Effort.find effort.id effort.next_step.must_equal "send_postcard_if_necessary" effort.history.count.must_equal 4 - effort.history[3].contrast_with!({"started_at"=> Time.now, "step"=>"determine_if_postcard_should_be_sent", "stopped_at" => Time.now, "result" => "move_to_next_step" } ) + effort.history[3].contrast_with!( { + "step_id" => effort.flow['steps'][1]['id'], + "started_at"=> Time.now, + "step"=>"determine_if_postcard_should_be_sent", + "stopped_at" => Time.now, + "result" => "move_to_next_step" + } ) # KEEP GOING send_postcard_if_necessary_worker.execute_all determine_if_postcard_should_be_sent_worker.execute_all wait_for_attempting_contact_stage_worker.execute_all effort = Seam::Effort.find effort.id effort.next_step.must_equal nil effort.history.count.must_equal 5 - effort.history[4].contrast_with!({"started_at"=> Time.now, "step"=>"send_postcard_if_necessary", "stopped_at" => Time.now, "result" => "move_to_next_step" } ) + effort.history[4].contrast_with!( { + "step_id" => effort.flow['steps'][2]['id'], + "started_at"=> Time.now, + "step"=>"send_postcard_if_necessary", + "stopped_at" => Time.now, + "result" => "move_to_next_step" + } ) end end describe "eject" do