From a0c612fb27098f3c28de5f7aaf56ecc9254fbfc9 Mon Sep 17 00:00:00 2001 From: Dzmitry Plashchynski Date: Sun, 15 Mar 2015 09:34:27 +0200 Subject: [PATCH] Use on in a period description --- lib/crono/period.rb | 1 + spec/period_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/crono/period.rb b/lib/crono/period.rb index 65d27e5..40210c1 100644 --- a/lib/crono/period.rb +++ b/lib/crono/period.rb @@ -20,6 +20,7 @@ module Crono def description desc = "every #{@period.inspect}" desc += format(' at %.2i:%.2i', @at_hour, @at_min) if @at_hour && @at_min + desc += " on #{DAYS[@on].capitalize}" if @on desc end diff --git a/spec/period_spec.rb b/spec/period_spec.rb index b8a8543..2a34c8a 100644 --- a/spec/period_spec.rb +++ b/spec/period_spec.rb @@ -9,8 +9,8 @@ describe Crono::Period do describe '#description' do it 'should return period description' do - @period = Crono::Period.new(2.day, at: '15:20') - expect(@period.description).to be_eql('every 2 days at 15:20') + @period = Crono::Period.new(1.week, on: :monday, at: '15:20') + expect(@period.description).to be_eql('every 7 days at 15:20 on Monday') end end