hiccup 0.5.8 → 0.5.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b6b5535b4c9f8e9ade95f3f969b3fec9b42500b7
4
- data.tar.gz: bbd1c41875bc71e2ae748d429aa26af5f275d5bc
3
+ metadata.gz: bb92bb351bb70b127d803017a755fbb60486e493
4
+ data.tar.gz: b16ac99ffe79acf0874df41d347b23820fbf395c
5
5
  SHA512:
6
- metadata.gz: eccd19bae5df503436db9a45c61c8c7b3fcaed69a0a7ed0adc654791b1bad956e5d4a47281b9646f2723567c3f1d911de12770684b3b473a2774368984f09f5a
7
- data.tar.gz: 2e0ae004bf47848458de41a7a17fcd23d92cefd3716bb6906ce018fbd899f52359c1f388d56303cae6e766ade11fbaada97f6eeca59ec17bc1e710c85430e916
6
+ metadata.gz: 4dfff15d9adb485161d7bc857e25a8836ad255d4bd9a49aaa8c1bd6a52eac5d25ace2ebca34ae5c2306bf7aad74477242b2c221eab4bbc9f47568bd838753dde
7
+ data.tar.gz: b972f70010604a6d1e7463351b6f60bf58ab1d8167101e0bed45ba9d033cb0cb4167fe7e8495be49fc0ca76d29a1d1808eac6452950e4d1bb00b722aadf7abb2
@@ -11,6 +11,13 @@ module Hiccup
11
11
  Date::DAYNAMES.index(weekday)
12
12
  end.sort
13
13
 
14
+ if @wday_pattern.empty?
15
+ @base_date = start_date
16
+ @starting_index = 0
17
+ @cycle = []
18
+ return
19
+ end
20
+
14
21
  start_wday = start_date.wday
15
22
  if start_wday <= @wday_pattern.first or start_wday > @wday_pattern.last
16
23
  @base_date = start_date
@@ -60,7 +67,7 @@ module Hiccup
60
67
 
61
68
  result = temp if !result || (temp < result)
62
69
  end
63
- @position = position_of(result)
70
+ @position = position_of(result) if result
64
71
  result
65
72
  end
66
73
 
@@ -77,7 +84,7 @@ module Hiccup
77
84
 
78
85
  result = temp if !result || (temp > result)
79
86
  end
80
- @position = position_of(result)
87
+ @position = position_of(result) if result
81
88
  result
82
89
  end
83
90
 
@@ -1,3 +1,3 @@
1
1
  module Hiccup
2
- VERSION = "0.5.8"
2
+ VERSION = "0.5.9"
3
3
  end
@@ -108,6 +108,28 @@ class WeeklyEnumeratorTest < ActiveSupport::TestCase
108
108
  end
109
109
 
110
110
 
111
+
112
+ context "Given an invalid schedule with no weekly pattern, it" do
113
+ setup do
114
+ @schedule = Schedule.new(
115
+ :kind => :weekly,
116
+ :start_date => Date.new(2013, 9, 26),
117
+ :weekly_pattern => [])
118
+ end
119
+
120
+ should "return nil for prev rather than raising an exception" do
121
+ enumerator = @schedule.enumerator.new(@schedule, Date.today)
122
+ assert_equal nil, enumerator.prev
123
+ end
124
+
125
+ should "return nil for next rather than raising an exception" do
126
+ enumerator = @schedule.enumerator.new(@schedule, Date.today)
127
+ assert_equal nil, enumerator.next
128
+ end
129
+ end
130
+
131
+
132
+
111
133
  private
112
134
 
113
135
  def cycle_for(options={})
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiccup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.8
4
+ version: 0.5.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bob Lail
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-18 00:00:00.000000000 Z
11
+ date: 2014-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport