hiccup 0.5.2 → 0.5.3
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.
- checksums.yaml +4 -4
- data/lib/hiccup/enumerable/monthly_enumerator.rb +1 -1
- data/lib/hiccup/version.rb +1 -1
- data/test/monthly_enumerator_test.rb +38 -0
- data/test/weekly_enumerator_test.rb +15 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b30ca9bc9c9e2acf7107c08c0dd88ed0a869585c
|
4
|
+
data.tar.gz: 68dd036beda7f04cb915eae77a5fe0033b2454f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66f8701394c598462e4178ccc5a10c915591c2206060a37c1724832a66c15712ea07652717e8f7d0bfdf8aa05c854507932b4b04907c219f5da62b8a58d8437f
|
7
|
+
data.tar.gz: c644a16b5d0c552c04ed193229236764d160f075f6679383f129812057da61ebb7d936976f0dffe70f0944f31a1e96e05dcbd2025f96a623c5ddeb6a22f04522
|
data/lib/hiccup/version.rb
CHANGED
@@ -0,0 +1,38 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
|
4
|
+
class MonthlyEnumeratorTest < ActiveSupport::TestCase
|
5
|
+
include Hiccup
|
6
|
+
|
7
|
+
|
8
|
+
context "with a complex schedule" do
|
9
|
+
setup do
|
10
|
+
@schedule = Schedule.new({
|
11
|
+
:kind => :monthly,
|
12
|
+
:monthly_pattern => [
|
13
|
+
[1, "Sunday"],
|
14
|
+
[2, "Saturday"],
|
15
|
+
[2, "Sunday"],
|
16
|
+
[3, "Sunday"],
|
17
|
+
[4, "Saturday"],
|
18
|
+
[4, "Sunday"],
|
19
|
+
[5, "Sunday"] ],
|
20
|
+
start_date: Date.new(2005, 1, 8)
|
21
|
+
})
|
22
|
+
end
|
23
|
+
|
24
|
+
context "when enumerating backward" do
|
25
|
+
|
26
|
+
should "return the most-recent date prior to the start_date, NOT the earliest date in the month" do
|
27
|
+
# Start with a date in the middle of the month
|
28
|
+
# More than one date prior to the seed date, yet
|
29
|
+
# after the first of the month.
|
30
|
+
date = Date.new(2013, 10, 15)
|
31
|
+
enumerator = @schedule.enumerator.new(@schedule, date)
|
32
|
+
assert_equal Date.new(2013, 10, 13), enumerator.prev
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
@@ -93,6 +93,21 @@ class WeeklyEnumeratorTest < ActiveSupport::TestCase
|
|
93
93
|
|
94
94
|
|
95
95
|
|
96
|
+
context "with a complex schedule" do
|
97
|
+
setup do
|
98
|
+
@schedule = Schedule.new(
|
99
|
+
:kind => :weekly,
|
100
|
+
:start_date => Date.new(2013, 9, 26), # Thursday
|
101
|
+
:weekly_pattern => ["Tuesday", "Thursday", "Friday"])
|
102
|
+
end
|
103
|
+
|
104
|
+
should "pick the right date when enumerating backward" do
|
105
|
+
enumerator = @schedule.enumerator.new(@schedule, Date.new(2013, 10, 16)) # Wednesday!
|
106
|
+
assert_equal Date.new(2013, 10, 15), enumerator.prev
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
|
96
111
|
private
|
97
112
|
|
98
113
|
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.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Lail
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -168,6 +168,7 @@ files:
|
|
168
168
|
- test/ical_serializable_test.rb
|
169
169
|
- test/inferrable_test.rb
|
170
170
|
- test/leap_year_test.rb
|
171
|
+
- test/monthly_enumerator_test.rb
|
171
172
|
- test/performance_test.rb
|
172
173
|
- test/test_helper.rb
|
173
174
|
- test/validatable_test.rb
|
@@ -203,6 +204,7 @@ test_files:
|
|
203
204
|
- test/ical_serializable_test.rb
|
204
205
|
- test/inferrable_test.rb
|
205
206
|
- test/leap_year_test.rb
|
207
|
+
- test/monthly_enumerator_test.rb
|
206
208
|
- test/performance_test.rb
|
207
209
|
- test/test_helper.rb
|
208
210
|
- test/validatable_test.rb
|