M Manifest.txt +0 -2
@@ 7,11 7,9 @@ README.md
Rakefile
lib/schedulability.rb
lib/schedulability/exceptions.rb
-lib/schedulability/mixins.rb
lib/schedulability/parser.rb
lib/schedulability/schedule.rb
spec/helpers.rb
-spec/schedulability/mixins_spec.rb
spec/schedulability/parser_spec.rb
spec/schedulability/schedule_spec.rb
spec/schedulability_spec.rb
R lib/schedulability/mixins.rb => +0 -201
@@ 1,201 0,0 @@
-# -*- ruby -*-
-#encoding: utf-8
-
-require 'schedulability' unless defined?( Schedulability )
-
-module Schedulability
-
- # Functions for time calculations
- module TimeFunctions
-
- ###############
- module_function
- ###############
-
- ### Calculate the (approximate) number of seconds that are in +count+ of the
- ### given +unit+ of time.
- ###
- def calculate_seconds( count, unit )
- return case unit
- when :seconds, :second
- count
- when :minutes, :minute
- count * 60
- when :hours, :hour
- count * 3600
- when :days, :day
- count * 86400
- when :weeks, :week
- count * 604800
- when :fortnights, :fortnight
- count * 1209600
- when :months, :month
- count * 2592000
- when :years, :year
- count * 31557600
- else
- raise ArgumentError, "don't know how to calculate seconds in a %p" % [ unit ]
- end
- end
- end # module TimeFunctions
-
-
- # Refinements to Numeric to add time-related convenience methods
- module TimeRefinements
- refine Numeric do
-
- ### Number of seconds (returns receiver unmodified)
- def seconds
- return self
- end
- alias_method :second, :seconds
-
- ### Returns number of seconds in <receiver> minutes
- def minutes
- return TimeFunctions.calculate_seconds( self, :minutes )
- end
- alias_method :minute, :minutes
-
- ### Returns the number of seconds in <receiver> hours
- def hours
- return TimeFunctions.calculate_seconds( self, :hours )
- end
- alias_method :hour, :hours
-
- ### Returns the number of seconds in <receiver> days
- def days
- return TimeFunctions.calculate_seconds( self, :day )
- end
- alias_method :day, :days
-
- ### Return the number of seconds in <receiver> weeks
- def weeks
- return TimeFunctions.calculate_seconds( self, :weeks )
- end
- alias_method :week, :weeks
-
- ### Returns the number of seconds in <receiver> fortnights
- def fortnights
- return TimeFunctions.calculate_seconds( self, :fortnights )
- end
- alias_method :fortnight, :fortnights
-
- ### Returns the number of seconds in <receiver> months (approximate)
- def months
- return TimeFunctions.calculate_seconds( self, :months )
- end
- alias_method :month, :months
-
- ### Returns the number of seconds in <receiver> years (approximate)
- def years
- return TimeFunctions.calculate_seconds( self, :years )
- end
- alias_method :year, :years
-
-
- ### Returns the Time <receiver> number of seconds before the
- ### specified +time+. E.g., 2.hours.before( header.expiration )
- def before( time )
- return time - self
- end
-
-
- ### Returns the Time <receiver> number of seconds ago. (e.g.,
- ### expiration > 2.hours.ago )
- def ago
- return self.before( ::Time.now )
- end
-
-
- ### Returns the Time <receiver> number of seconds after the given +time+.
- ### E.g., 10.minutes.after( header.expiration )
- def after( time )
- return time + self
- end
-
-
- ### Return a new Time <receiver> number of seconds from now.
- def from_now
- return self.after( ::Time.now )
- end
-
- end # refine Numeric
-
-
- refine Time do
-
- # Approximate Time Constants (in seconds)
- MINUTES = 60
- HOURS = 60 * MINUTES
- DAYS = 24 * HOURS
- WEEKS = 7 * DAYS
- MONTHS = 30 * DAYS
- YEARS = 365.25 * DAYS
-
-
- ### Returns +true+ if the receiver is a Time in the future.
- def future?
- return self > Time.now
- end
-
-
- ### Returns +true+ if the receiver is a Time in the past.
- def past?
- return self < Time.now
- end
-
-
- ### Return a description of the receiving Time object in relation to the current
- ### time.
- ###
- ### Example:
- ###
- ### "Saved %s ago." % object.updated_at.as_delta
- def as_delta
- now = Time.now
- if now > self
- seconds = now - self
- return "%s ago" % [ timeperiod(seconds) ]
- else
- seconds = self - now
- return "%s from now" % [ timeperiod(seconds) ]
- end
- end
-
-
- ### Return a description of +seconds+ as the nearest whole unit of time.
- def timeperiod( seconds )
- return case
- when seconds < MINUTES - 5
- 'less than a minute'
- when seconds < 50 * MINUTES
- if seconds <= 89
- "a minute"
- else
- "%d minutes" % [ (seconds.to_f / MINUTES).ceil ]
- end
- when seconds < 90 * MINUTES
- 'about an hour'
- when seconds < 18 * HOURS
- "%d hours" % [ (seconds.to_f / HOURS).ceil ]
- when seconds < 30 * HOURS
- 'about a day'
- when seconds < WEEKS
- "%d days" % [ (seconds.to_f / DAYS).ceil ]
- when seconds < 2 * WEEKS
- 'about a week'
- when seconds < 3 * MONTHS
- "%d weeks" % [ (seconds.to_f / WEEKS).round ]
- when seconds < 18 * MONTHS
- "%d months" % [ (seconds.to_f / MONTHS).ceil ]
- else
- "%d years" % [ (seconds.to_f / YEARS).ceil ]
- end
- end
-
- end # refine Time
-
- end # module TimeRefinements
-
-end # module Schedulability
-
R spec/schedulability/mixins_spec.rb => +0 -164
@@ 1,164 0,0 @@
-#!/usr/bin/env rspec -cfd
-
-require_relative '../helpers'
-
-require 'schedulability/mixins'
-
-
-describe Schedulability, 'mixins' do
-
-
- describe Schedulability::TimeRefinements do
-
- using( described_class )
-
-
- describe "used to extend Numeric objects" do
-
- SECONDS_IN_A_MINUTE = 60
- SECONDS_IN_AN_HOUR = SECONDS_IN_A_MINUTE * 60
- SECONDS_IN_A_DAY = SECONDS_IN_AN_HOUR * 24
- SECONDS_IN_A_WEEK = SECONDS_IN_A_DAY * 7
- SECONDS_IN_A_FORTNIGHT = SECONDS_IN_A_WEEK * 2
- SECONDS_IN_A_MONTH = SECONDS_IN_A_DAY * 30
- SECONDS_IN_A_YEAR = Integer( SECONDS_IN_A_DAY * 365.25 )
-
-
- it "can calculate the number of seconds for various units of time" do
- expect( 1.second ).to eq( 1 )
- expect( 14.seconds ).to eq( 14 )
-
- expect( 1.minute ).to eq( SECONDS_IN_A_MINUTE )
- expect( 18.minutes ).to eq( SECONDS_IN_A_MINUTE * 18 )
-
- expect( 1.hour ).to eq( SECONDS_IN_AN_HOUR )
- expect( 723.hours ).to eq( SECONDS_IN_AN_HOUR * 723 )
-
- expect( 1.day ).to eq( SECONDS_IN_A_DAY )
- expect( 3.days ).to eq( SECONDS_IN_A_DAY * 3 )
-
- expect( 1.week ).to eq( SECONDS_IN_A_WEEK )
- expect( 28.weeks ).to eq( SECONDS_IN_A_WEEK * 28 )
-
- expect( 1.fortnight ).to eq( SECONDS_IN_A_FORTNIGHT )
- expect( 31.fortnights ).to eq( SECONDS_IN_A_FORTNIGHT * 31 )
-
- expect( 1.month ).to eq( SECONDS_IN_A_MONTH )
- expect( 67.months ).to eq( SECONDS_IN_A_MONTH * 67 )
-
- expect( 1.year ).to eq( SECONDS_IN_A_YEAR )
- expect( 13.years ).to eq( SECONDS_IN_A_YEAR * 13 )
- end
-
-
- it "can calculate various time offsets" do
- starttime = Time.now
-
- expect( 1.second.after( starttime ) ).to eq( starttime + 1 )
- expect( 18.seconds.from_now ).to be_within( 10.seconds ).of( starttime + 18 )
-
- expect( 1.second.before( starttime ) ).to eq( starttime - 1 )
- expect( 3.hours.ago ).to be_within( 10.seconds ).of( starttime - 10800 )
- end
-
- end
-
-
- context "used to extend Time objects" do
-
- it "makes them aware of whether they're in the future or not" do
- Timecop.freeze do
- time = Time.now
- expect( time.future? ).to be_falsey
-
- future_time = time + 1
- expect( future_time.future? ).to be_truthy
-
- past_time = time - 1
- expect( past_time.future? ).to be_falsey
- end
- end
-
-
- it "makes them aware of whether they're in the past or not" do
- Timecop.freeze do
- time = Time.now
- expect( time.past? ).to be_falsey
-
- future_time = time + 1
- expect( future_time.past? ).to be_falsey
-
- past_time = time - 1
- expect( past_time.past? ).to be_truthy
- end
- end
-
-
- it "adds the ability to express themselves as an offset in English" do
- Timecop.freeze do
- expect( 1.second.ago.as_delta ).to eq( 'less than a minute ago' )
- expect( 1.second.from_now.as_delta ).to eq( 'less than a minute from now' )
-
- expect( 1.minute.ago.as_delta ).to eq( 'a minute ago' )
- expect( 1.minute.from_now.as_delta ).to eq( 'a minute from now' )
- expect( 68.seconds.ago.as_delta ).to eq( 'a minute ago' )
- expect( 68.seconds.from_now.as_delta ).to eq( 'a minute from now' )
- expect( 2.minutes.ago.as_delta ).to eq( '2 minutes ago' )
- expect( 2.minutes.from_now.as_delta ).to eq( '2 minutes from now' )
- expect( 38.minutes.ago.as_delta ).to eq( '38 minutes ago' )
- expect( 38.minutes.from_now.as_delta ).to eq( '38 minutes from now' )
-
- expect( 1.hour.ago.as_delta ).to eq( 'about an hour ago' )
- expect( 1.hour.from_now.as_delta ).to eq( 'about an hour from now' )
- expect( 75.minutes.ago.as_delta ).to eq( 'about an hour ago' )
- expect( 75.minutes.from_now.as_delta ).to eq( 'about an hour from now' )
-
- expect( 2.hours.ago.as_delta ).to eq( '2 hours ago' )
- expect( 2.hours.from_now.as_delta ).to eq( '2 hours from now' )
- expect( 14.hours.ago.as_delta ).to eq( '14 hours ago' )
- expect( 14.hours.from_now.as_delta ).to eq( '14 hours from now' )
-
- expect( 22.hours.ago.as_delta ).to eq( 'about a day ago' )
- expect( 22.hours.from_now.as_delta ).to eq( 'about a day from now' )
- expect( 28.hours.ago.as_delta ).to eq( 'about a day ago' )
- expect( 28.hours.from_now.as_delta ).to eq( 'about a day from now' )
-
- expect( 36.hours.ago.as_delta ).to eq( '2 days ago' )
- expect( 36.hours.from_now.as_delta ).to eq( '2 days from now' )
- expect( 4.days.ago.as_delta ).to eq( '4 days ago' )
- expect( 4.days.from_now.as_delta ).to eq( '4 days from now' )
-
- expect( 1.week.ago.as_delta ).to eq( 'about a week ago' )
- expect( 1.week.from_now.as_delta ).to eq( 'about a week from now' )
- expect( 8.days.ago.as_delta ).to eq( 'about a week ago' )
- expect( 8.days.from_now.as_delta ).to eq( 'about a week from now' )
-
- expect( 15.days.ago.as_delta ).to eq( '2 weeks ago' )
- expect( 15.days.from_now.as_delta ).to eq( '2 weeks from now' )
- expect( 3.weeks.ago.as_delta ).to eq( '3 weeks ago' )
- expect( 3.weeks.from_now.as_delta ).to eq( '3 weeks from now' )
-
- expect( 1.month.ago.as_delta ).to eq( '4 weeks ago' )
- expect( 1.month.from_now.as_delta ).to eq( '4 weeks from now' )
- expect( 36.days.ago.as_delta ).to eq( '5 weeks ago' )
- expect( 36.days.from_now.as_delta ).to eq( '5 weeks from now' )
-
- expect( 6.months.ago.as_delta ).to eq( '6 months ago' )
- expect( 6.months.from_now.as_delta ).to eq( '6 months from now' )
- expect( 14.months.ago.as_delta ).to eq( '14 months ago' )
- expect( 14.months.from_now.as_delta ).to eq( '14 months from now' )
-
- expect( 6.year.ago.as_delta ).to eq( '6 years ago' )
- expect( 6.year.from_now.as_delta ).to eq( '6 years from now' )
- expect( 14.years.ago.as_delta ).to eq( '14 years ago' )
- expect( 14.years.from_now.as_delta ).to eq( '14 years from now' )
- end
- end
-
- end
-
- end
-
-
-end
-
M spec/schedulability/schedule_spec.rb +91 -94
@@ 5,11 5,8 @@ require_relative '../helpers'
require 'time'
require 'timecop'
require 'schedulability/schedule'
-require 'schedulability/mixins'
-using Schedulability::TimeRefinements
-
describe Schedulability::Schedule do
before( :all ) do
@@ 184,11 181,11 @@ describe Schedulability::Schedule do
schedule = described_class.parse( "sec {18}" )
time = Time.iso8601( '2015-12-15T12:00:18-00:00' )
- expect( schedule ).to_not include( time - 2.seconds )
- expect( schedule ).to_not include( time - 1.second )
+ expect( schedule ).to_not include( time - 2 )
+ expect( schedule ).to_not include( time - 1 )
expect( schedule ).to include( time )
- expect( schedule ).to_not include( time + 1.second )
- expect( schedule ).to_not include( time + 2.seconds )
+ expect( schedule ).to_not include( time + 1 )
+ expect( schedule ).to_not include( time + 2 )
end
@@ 196,11 193,11 @@ describe Schedulability::Schedule do
schedule = described_class.parse( "except sec {18}" )
time = Time.iso8601( '2015-12-15T12:00:18-00:00' )
- expect( schedule ).to include( time - 2.seconds )
- expect( schedule ).to include( time - 1.second )
+ expect( schedule ).to include( time - 2 )
+ expect( schedule ).to include( time - 1 )
expect( schedule ).to_not include( time )
- expect( schedule ).to include( time + 1.second )
- expect( schedule ).to include( time + 2.seconds )
+ expect( schedule ).to include( time + 1 )
+ expect( schedule ).to include( time + 2 )
end
@@ 208,12 205,12 @@ describe Schedulability::Schedule do
schedule = described_class.parse( "sec {10-20}" )
time = Time.iso8601( '2015-12-15T12:00:10-00:00' )
- expect( schedule ).to_not include( time - 2.seconds )
- expect( schedule ).to_not include( time - 1.second )
+ expect( schedule ).to_not include( time - 2 )
+ expect( schedule ).to_not include( time - 1 )
expect( schedule ).to include( time )
- expect( schedule ).to include( time + 1.second )
- expect( schedule ).to include( time + 9.seconds )
- expect( schedule ).to_not include( time + 10.seconds )
+ expect( schedule ).to include( time + 1 )
+ expect( schedule ).to include( time + 9 )
+ expect( schedule ).to_not include( time + 10 )
end
@@ 221,15 218,15 @@ describe Schedulability::Schedule do
schedule = described_class.parse( "sec {45-15}" )
time = Time.iso8601( '2015-12-15T12:00:45-00:00' )
- expect( schedule ).to_not include( time - 2.seconds )
- expect( schedule ).to_not include( time - 1.second )
+ expect( schedule ).to_not include( time - 2 )
+ expect( schedule ).to_not include( time - 1 )
expect( schedule ).to include( time )
- expect( schedule ).to include( time + 1.second )
- expect( schedule ).to include( time + 14.seconds )
- expect( schedule ).to include( time + 15.seconds )
- expect( schedule ).to include( time + 20.seconds )
- expect( schedule ).to include( time + 29.seconds )
- expect( schedule ).to_not include( time + 30.seconds )
+ expect( schedule ).to include( time + 1 )
+ expect( schedule ).to include( time + 14 )
+ expect( schedule ).to include( time + 15 )
+ expect( schedule ).to include( time + 20 )
+ expect( schedule ).to include( time + 29 )
+ expect( schedule ).to_not include( time + 30 )
end
@@ 237,13 234,13 @@ describe Schedulability::Schedule do
schedule = described_class.parse( "min {28}" )
time = Time.iso8601( '2015-12-15T12:28:00-00:00' )
- expect( schedule ).to_not include( time - 15.seconds )
- expect( schedule ).to_not include( time - 1.second )
+ expect( schedule ).to_not include( time - 15 )
+ expect( schedule ).to_not include( time - 1 )
expect( schedule ).to include( time )
- expect( schedule ).to include( time + 38.seconds )
- expect( schedule ).to include( time + 59.seconds )
- expect( schedule ).to_not include( time + 1.minute )
- expect( schedule ).to_not include( time + 2.minutes )
+ expect( schedule ).to include( time + 38 )
+ expect( schedule ).to include( time + 59 )
+ expect( schedule ).to_not include( time + 60 )
+ expect( schedule ).to_not include( time + 2 * 60 )
end
@@ 251,13 248,13 @@ describe Schedulability::Schedule do
schedule = described_class.parse( "min {25-35}" )
time = Time.iso8601( '2015-12-15T12:25:00-00:00' )
- expect( schedule ).to_not include( time - 2.minutes )
- expect( schedule ).to_not include( time - 1.second )
+ expect( schedule ).to_not include( time - 60 )
+ expect( schedule ).to_not include( time - 1 )
expect( schedule ).to include( time )
- expect( schedule ).to include( time + 1.minute )
- expect( schedule ).to include( time + 9.minutes )
- expect( schedule ).to include( time + 9.minutes + 59.seconds )
- expect( schedule ).to_not include( time + 10.minutes )
+ expect( schedule ).to include( time + 60 )
+ expect( schedule ).to include( time + 9 * 60 )
+ expect( schedule ).to include( time + (9 * 60) + 59 )
+ expect( schedule ).to_not include( time + 10 * 60 )
end
@@ 265,18 262,18 @@ describe Schedulability::Schedule do
schedule = described_class.parse( "min {50-15}" )
time = Time.iso8601( '2015-12-15T12:50:00-00:00' )
- expect( schedule ).to_not include( time - 1.minute )
- expect( schedule ).to_not include( time - 1.second )
+ expect( schedule ).to_not include( time - 60 )
+ expect( schedule ).to_not include( time - 1 )
expect( schedule ).to include( time )
- expect( schedule ).to include( time + 1.second )
- expect( schedule ).to include( time + 1.minute )
- expect( schedule ).to include( time + 9.minutes )
- expect( schedule ).to include( time + 9.minutes + 59.seconds )
- expect( schedule ).to include( time + 10.minutes )
- expect( schedule ).to include( time + 20.minutes )
- expect( schedule ).to include( time + 24.minutes )
- expect( schedule ).to include( time + 24.minutes + 59.seconds )
- expect( schedule ).to_not include( time + 25.minutes )
+ expect( schedule ).to include( time + 1 )
+ expect( schedule ).to include( time + 60 )
+ expect( schedule ).to include( time + 9 * 60 )
+ expect( schedule ).to include( time + 9 * 60 + 59 )
+ expect( schedule ).to include( time + 10 * 60 )
+ expect( schedule ).to include( time + 20 * 60 )
+ expect( schedule ).to include( time + 24 * 60 )
+ expect( schedule ).to include( time + 24 * 60 + 59 )
+ expect( schedule ).to_not include( time + 25 * 60 )
end
@@ 286,11 283,11 @@ describe Schedulability::Schedule do
expect( schedule ).to_not include( time - 1 )
expect( schedule ).to include( time )
- expect( schedule ).to include( time + 1.minute )
- expect( schedule ).to include( time + 20.minutes )
- expect( schedule ).to include( time + (1.hour - 1.minute) )
- expect( schedule ).to_not include( time + 1.hour )
- expect( schedule ).to_not include( time + 3.hours )
+ expect( schedule ).to include( time + 60 )
+ expect( schedule ).to include( time + 20 * 60 )
+ expect( schedule ).to include( time + (3600 - 60) )
+ expect( schedule ).to_not include( time + 3600 )
+ expect( schedule ).to_not include( time + 3 * 3600 )
end
@@ 298,15 295,15 @@ describe Schedulability::Schedule do
schedule = described_class.parse( "hr {9am-5pm}" )
time = Time.iso8601( '2015-12-15T09:00:00-00:00' )
- expect( schedule ).to_not include( time - 12.hours )
- expect( schedule ).to_not include( time - 10.minutes )
- expect( schedule ).to_not include( time - 1.second )
+ expect( schedule ).to_not include( time - 12 * 3600 )
+ expect( schedule ).to_not include( time - 10 * 60 )
+ expect( schedule ).to_not include( time - 1 )
expect( schedule ).to include( time )
- expect( schedule ).to include( time + 1.minute )
- expect( schedule ).to include( time + 1.hour )
- expect( schedule ).to include( time + 7.hours )
- expect( schedule ).to include( time + (8.hours - 1.second) )
- expect( schedule ).to_not include( time + 8.hours )
+ expect( schedule ).to include( time + 60 )
+ expect( schedule ).to include( time + 3600 )
+ expect( schedule ).to include( time + 7 * 3600 )
+ expect( schedule ).to include( time + (8 * 3600 - 1) )
+ expect( schedule ).to_not include( time + 8 * 3600 )
end
@@ 314,21 311,21 @@ describe Schedulability::Schedule do
schedule = described_class.parse( "hr {5pm-9am}" )
time = Time.iso8601( '2015-12-15T17:00:00-00:00' )
- expect( schedule ).to_not include( time - 1.hour )
- expect( schedule ).to_not include( time - 1.second )
+ expect( schedule ).to_not include( time - 3600 )
+ expect( schedule ).to_not include( time - 1 )
expect( schedule ).to include( time )
- expect( schedule ).to include( time + 1.second )
- expect( schedule ).to include( time + 1.minute )
- expect( schedule ).to include( time + 10.minutes )
- expect( schedule ).to include( time + 2.hours )
- expect( schedule ).to include( time + (7.hours - 1.second) )
- expect( schedule ).to include( time + 7.hours )
- expect( schedule ).to include( time + 12.hours )
- expect( schedule ).to include( time + (16.hours - 1.second) )
- expect( schedule ).to include( time + 24.hours )
- expect( schedule ).to_not include( time + (24.hours - 1.second) )
- expect( schedule ).to_not include( time + 16.hours )
- expect( schedule ).to_not include( time + 18.hours )
+ expect( schedule ).to include( time + 1 )
+ expect( schedule ).to include( time + 60 )
+ expect( schedule ).to include( time + 10 * 60 )
+ expect( schedule ).to include( time + 2 * 3600 )
+ expect( schedule ).to include( time + (7 * 3600 - 1) )
+ expect( schedule ).to include( time + 7 * 3600 )
+ expect( schedule ).to include( time + 12 * 3600 )
+ expect( schedule ).to include( time + (16 * 3600 - 1) )
+ expect( schedule ).to include( time + 24 * 3600 )
+ expect( schedule ).to_not include( time + (24 * 3600 - 1) )
+ expect( schedule ).to_not include( time + 16 * 3600 )
+ expect( schedule ).to_not include( time + 18 * 3600 )
end
@@ 338,11 335,11 @@ describe Schedulability::Schedule do
expect( schedule ).to_not include( time - 1 )
expect( schedule ).to include( time )
- expect( schedule ).to include( time + 1.minute )
- expect( schedule ).to include( time + 20.minutes )
- expect( schedule ).to include( time + (1.hour - 1.minute) )
- expect( schedule ).to_not include( time + 1.hour )
- expect( schedule ).to_not include( time + 3.hours )
+ expect( schedule ).to include( time + 60 )
+ expect( schedule ).to include( time + 20 * 60 )
+ expect( schedule ).to include( time + (3600 - 60) )
+ expect( schedule ).to_not include( time + 3600 )
+ expect( schedule ).to_not include( time + 3 * 3600 )
end
@@ 353,11 350,11 @@ describe Schedulability::Schedule do
expect( schedule ).to_not include( time - 1 )
expect( schedule ).to include( time )
- expect( schedule ).to include( time + 1.minute )
- expect( schedule ).to include( time + 20.minutes )
- expect( schedule ).to include( time + (1.hour - 1.minute) )
- expect( schedule ).to_not include( time + 1.hour )
- expect( schedule ).to_not include( time + 3.hours )
+ expect( schedule ).to include( time + 60 )
+ expect( schedule ).to include( time + 20 * 60 )
+ expect( schedule ).to include( time + (3600 - 60) )
+ expect( schedule ).to_not include( time + 3600 )
+ expect( schedule ).to_not include( time + 3 * 3600 )
end
@@ 367,11 364,11 @@ describe Schedulability::Schedule do
expect( schedule ).to_not include( time - 1 )
expect( schedule ).to include( time )
- expect( schedule ).to include( time + 1.minute )
- expect( schedule ).to include( time + 20.minutes )
- expect( schedule ).to include( time + (1.hour - 1.minute) )
- expect( schedule ).to_not include( time + 1.hour )
- expect( schedule ).to_not include( time + 3.hours )
+ expect( schedule ).to include( time + 60 )
+ expect( schedule ).to include( time + 20 * 60 )
+ expect( schedule ).to include( time + (3600 - 60) )
+ expect( schedule ).to_not include( time + 3600 )
+ expect( schedule ).to_not include( time + 3 * 3600 )
end
@@ 381,11 378,11 @@ describe Schedulability::Schedule do
expect( schedule ).to_not include( time - 1 )
expect( schedule ).to include( time )
- expect( schedule ).to include( time + 1.minute )
- expect( schedule ).to include( time + 20.minutes )
- expect( schedule ).to include( time + (1.hour - 1.minute) )
- expect( schedule ).to_not include( time + 1.hour )
- expect( schedule ).to_not include( time + 3.hours )
+ expect( schedule ).to include( time + 60 )
+ expect( schedule ).to include( time + 20 * 60 )
+ expect( schedule ).to include( time + (3600 - 60) )
+ expect( schedule ).to_not include( time + 3600 )
+ expect( schedule ).to_not include( time + 3 * 3600 )
end