From 007989fa2cff12e4b65a4317f1684d20fde4295d Mon Sep 17 00:00:00 2001 From: Dzmitry Plashchynski Date: Thu, 5 Mar 2015 14:03:07 +0200 Subject: [PATCH] Add Job#description --- lib/crono/job.rb | 4 ++++ spec/job_spec.rb | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/lib/crono/job.rb b/lib/crono/job.rb index 2e2b754..1dba45e 100644 --- a/lib/crono/job.rb +++ b/lib/crono/job.rb @@ -12,6 +12,10 @@ module Crono period.next(since: last_performed_at) end + def description + "Perform #{performer} #{period.description}" + end + def perform Crono.logger.info "Perform #{performer}" self.last_performed_at = Time.now diff --git a/spec/job_spec.rb b/spec/job_spec.rb index 0d93486..b785ae8 100644 --- a/spec/job_spec.rb +++ b/spec/job_spec.rb @@ -19,4 +19,10 @@ describe Crono::Job do expect(thread).to be_stop end end + + describe "#description" do + it "should return job identificator" do + expect(job.description).to be_eql("Perform TestJob every 2 days") + end + end end