timetress 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -60,6 +60,12 @@ module Timetress
60
60
  private
61
61
 
62
62
  def next_holiday(holiday, given_date)
63
+ given_date ||= Date.today
64
+
65
+ unless given_date.respond_to?(:to_datetime)
66
+ raise ArgumentError.new("#{given_date.inspect} must be a date or time object")
67
+ end
68
+
63
69
  the_day = self.send(holiday.to_sym, given_date.year)
64
70
 
65
71
  if the_day < given_date
@@ -1,3 +1,3 @@
1
1
  module Timetress
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
@@ -105,5 +105,14 @@ describe Timetress::Holiday do
105
105
  Timetress.next_pi_day(pi_day + 1).should eq(next_pi_day)
106
106
  end
107
107
 
108
+ it "default is relative to today" do
109
+ Timetress::Norway.next_pi_day.should eq(Timetress::Norway.next_pi_day(Date.today))
110
+ end
111
+
112
+ it "complains if given a non-date argument" do
113
+ ->{ Timetress::Norway.next_pi_day("a string") }.should raise_error(ArgumentError)
114
+ ->{ Timetress::Norway.next_pi_day(1) }.should raise_error(ArgumentError)
115
+ end
116
+
108
117
  end
109
118
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timetress
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-26 00:00:00.000000000 Z
12
+ date: 2012-10-30 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Answers the age-old question 'When is mothersday this year?'
15
15
  email: