hiccup 0.5.18 → 0.5.19

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: 5b2f49ba420f01d88054405099c8018481fbd287
4
- data.tar.gz: 238c4d45fefd07b91b72ec70c8cd43c23a324e40
3
+ metadata.gz: f309cbeec6d69a8c8fd3577a5df9b8b96e22ccd4
4
+ data.tar.gz: a3cc99a866dcdb0a414bdc8d802289e033f89286
5
5
  SHA512:
6
- metadata.gz: f6b93567956cd2211d490e8aea9533c4f18cbb2f5262f9ecf97e94084c31aa0261071bd9b345b19fa45ed97b9c15d90ffe710fd5fcd5fa9ae3d312e72bab782b
7
- data.tar.gz: 8bfbda4a4ba9b3d338d4b579cbe86f3b1fceffab2bb3f6f153d22854d1d4516054d0a0c193b136c8551e8fb94573580b07d881a48c4168f0f55e8ae0b5c7a355
6
+ metadata.gz: f1f5fc8cfa1d4c175acabc66ffaf0f6920090da237515622d3d8c1b7384cd8010bec40fe981f31b65bf77a1536367641ff923a41852c907d1fd0643a3b283ec5
7
+ data.tar.gz: c479e685962de09343e830d8a606ca1c83a162b24bd747f33ee197b8228be01b1335ed6f674f00db69ac805d1951927c647a0cb90ba2e6bc16a5afda49da0bc7
@@ -122,7 +122,7 @@ module Hiccup
122
122
  else
123
123
  coerce_day_to_positive(occurrence)
124
124
  end
125
- end
125
+ end.uniq
126
126
  end
127
127
 
128
128
 
@@ -9,7 +9,7 @@ module Hiccup
9
9
 
10
10
  @wday_pattern = weekly_pattern.map do |weekday|
11
11
  Date::DAYNAMES.index(weekday)
12
- end.sort
12
+ end.sort.uniq
13
13
 
14
14
  if @wday_pattern.empty?
15
15
  @base_date = start_date
@@ -1,3 +1,3 @@
1
1
  module Hiccup
2
- VERSION = "0.5.18"
2
+ VERSION = "0.5.19"
3
3
  end
@@ -460,6 +460,49 @@ class EnumerableTest < ActiveSupport::TestCase
460
460
 
461
461
 
462
462
 
463
+ context "Duplication:" do
464
+ context "A weekly schedule that lists the same day twice" do
465
+ setup do
466
+ @schedule = Schedule.new(
467
+ kind: :weekly,
468
+ start_date: Date.new(2015, 1, 1),
469
+ weekly_pattern: %w{Monday Monday})
470
+ end
471
+
472
+ should "not enumerate that date more than once" do
473
+ assert_equal [5, 12, 19, 26], occurrences_during_month(schedule, 2015, 1).map(&:day)
474
+ end
475
+ end
476
+
477
+ context "A monthly (by-weekday) schedule that lists the same day twice" do
478
+ setup do
479
+ @schedule = Schedule.new(
480
+ kind: :monthly,
481
+ start_date: Date.new(2015, 1, 1),
482
+ monthly_pattern: [[3, "Monday"], [3, "Monday"]])
483
+ end
484
+
485
+ should "not enumerate that date more than once" do
486
+ assert_equal [19], occurrences_during_month(schedule, 2015, 1).map(&:day)
487
+ end
488
+ end
489
+
490
+ context "A monthly (by-day) schedule that lists the same day twice" do
491
+ setup do
492
+ @schedule = Schedule.new(
493
+ kind: :monthly,
494
+ start_date: Date.new(2015, 1, 1),
495
+ monthly_pattern: [3, 5])
496
+ end
497
+
498
+ should "not enumerate that date more than once" do
499
+ assert_equal [3, 5], occurrences_during_month(schedule, 2015, 1).map(&:day)
500
+ end
501
+ end
502
+ end
503
+
504
+
505
+
463
506
  if ENV['PERFORMANCE_TEST']
464
507
  test "performance test" do
465
508
  n = 1000
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.18
4
+ version: 0.5.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bob Lail
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-01 00:00:00.000000000 Z
11
+ date: 2015-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport