us_bank_holidays 0.1.0 → 0.2.0

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
- SHA1:
3
- metadata.gz: d44603e174d94f3058f71f7bdf030e762c350f78
4
- data.tar.gz: b8ad012d2c75fd2b29270980bfa0e53dd0de04d3
2
+ SHA256:
3
+ metadata.gz: 1f9ef1ece79b15a1e2431e7627d0bc36914e86fb0e76b39310551d4198c728d0
4
+ data.tar.gz: c27c824131609ffcb000915313d80778322f88ffbaef9ab52c8a8c0137db55fa
5
5
  SHA512:
6
- metadata.gz: 90647b055da3c2ee6c1e2853e2c4ae0b6f054034421b7ad051154383b792408c0dec52969f899d37237b3826002ae3573ad227930e95f2161596e4e8d6636c63
7
- data.tar.gz: 3a63bd609a2f63b53f030a495a4030ac40d752a87b81dd94a4d4567c349be4157b635a71fb06739280e13e55ec896f207ce330d5af3e2ff8caaf39c7a672287b
6
+ metadata.gz: bd9bc1def99590c5e5b706f2e0ccdc60c3e346b7c8f6e0d8900dd34462ff1e28dc1a362f13f33e8a911d8d8111a8f02b44fcbb7b14ff254a764b5349174571fc
7
+ data.tar.gz: d8324975d14a8ca035620bb572dfce8ac159ab18edc5d3540a91553ad48815acbd561313768405da41abd03379df06c32a8f585dcb942e35adb21483de13cee5
data/.travis.yml CHANGED
@@ -1,10 +1,9 @@
1
1
  language: ruby
2
2
  script: 'bundle exec rake spec'
3
3
  rvm:
4
- - 2.0
5
- - 2.1
6
- - 2.2
7
4
  - 2.3
5
+ - 2.4
6
+ - 2.5
8
7
  - jruby
9
8
  - rbx
10
9
  matrix:
data/README.md CHANGED
@@ -12,8 +12,8 @@ Patches `Date` to make working with US bank holidays easier
12
12
 
13
13
  Tested against the following Ruby runtimes:
14
14
 
15
- * MRI 1.9.3, 2.0.0, 2.1.0
16
- * JRuby 1.7+
15
+ * MRI 2.3, 2.4, 2.5
16
+ * JRuby 9
17
17
  * Rubinius (latest)
18
18
 
19
19
  ## Installation
@@ -9,6 +9,7 @@ module UsBankHolidays
9
9
  :mlk_day,
10
10
  :washingtons_birthday,
11
11
  :memorial_day,
12
+ :juneteenth,
12
13
  :independence_day,
13
14
  :labor_day,
14
15
  :columbus_day,
@@ -29,22 +30,24 @@ module UsBankHolidays
29
30
  # be observed.
30
31
  def bank_holidays
31
32
  @bank_holidays ||= begin
32
- holidays = [ new_years_day,
33
- mlk_day,
34
- washingtons_birthday,
35
- memorial_day,
36
- independence_day,
37
- labor_day,
38
- columbus_day,
39
- veterans_day,
40
- thanksgiving,
41
- christmas
42
- ]
43
- if Date.new(year + 1, 1, 1).saturday?
44
- holidays << Date.new(year, 12, 31)
45
- end
46
- holidays.freeze
47
- end
33
+ holidays = [
34
+ new_years_day,
35
+ mlk_day,
36
+ washingtons_birthday,
37
+ memorial_day,
38
+ juneteenth,
39
+ independence_day,
40
+ labor_day,
41
+ columbus_day,
42
+ veterans_day,
43
+ thanksgiving,
44
+ christmas
45
+ ].compact
46
+ if Date.new(year + 1, 1, 1).saturday?
47
+ holidays << Date.new(year, 12, 31)
48
+ end
49
+ holidays.freeze
50
+ end
48
51
  end
49
52
 
50
53
  {
@@ -96,7 +99,10 @@ module UsBankHolidays
96
99
  # First of the year, rolls either forward or back.
97
100
  @new_years_day = roll_nominal(Date.new(year, 1, 1))
98
101
 
99
- # 4'th of July
102
+ # 19th of June
103
+ @juneteenth = (year > 2020 ? roll_nominal(Date.new(year, 6, 19)) : nil )
104
+
105
+ # 4th of July
100
106
  @independence_day = roll_nominal(Date.new(year, 7, 4))
101
107
 
102
108
  # November 11
@@ -1,3 +1,3 @@
1
1
  module UsBankHolidays
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -1,51 +1,104 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe UsBankHolidays::HolidayYear do
3
+ RSpec.describe UsBankHolidays::HolidayYear do
4
4
 
5
5
  context "should determine bank holidays" do
6
6
 
7
- context "Force Saturday date rolling" do
8
- before :each do
9
- allow(::UsBankHolidays).to receive(:saturday_holiday_date_rolling?).and_return(true)
7
+ context "Before 2021" do
8
+
9
+ context "Force Saturday date rolling" do
10
+ before :each do
11
+ allow(::UsBankHolidays).to receive(:saturday_holiday_date_rolling?).and_return(true)
12
+ end
13
+
14
+ it 'should determine bank holidays' do
15
+ expect(UsBankHolidays::HolidayYear.new(2017).bank_holidays).to eq([
16
+ '2017-01-02', #New Year’s Day
17
+ '2017-01-16', #Birthday of Martin Luther King, Jr.
18
+ '2017-02-20', #Washington’s Birthday
19
+ '2017-05-29', #Memorial Day
20
+ '2017-07-04', #Independence Day
21
+ '2017-09-04', #Labor Day
22
+ '2017-10-09', #Columbus Day
23
+ '2017-11-10', #Veterans Day
24
+ '2017-11-23', #Thanksgiving Day
25
+ '2017-12-25' #Christmas Day
26
+ ].map { |d| Date.parse(d) }
27
+ )
28
+ end
29
+
10
30
  end
11
31
 
12
- it 'should determine bank holidays' do
13
- expect(UsBankHolidays::HolidayYear.new(2017).bank_holidays).to eq([
14
- '2017-01-02', #New Year’s Day
15
- '2017-01-16', #Birthday of Martin Luther King, Jr.
16
- '2017-02-20', #Washington’s Birthday
17
- '2017-05-29', #Memorial Day
18
- '2017-07-04', #Independence Day
19
- '2017-09-04', #Labor Day
20
- '2017-10-09', #Columbus Day
21
- '2017-11-10', #Veterans Day
22
- '2017-11-23', #Thanksgiving Day
23
- '2017-12-25' #Christmas Day
24
- ].map {|d| Date.parse(d)}
25
- )
32
+ context "No Saturday date rolling" do
33
+ it 'should determine bank holidays' do
34
+ expect(UsBankHolidays::HolidayYear.new(2017).bank_holidays).to eq([
35
+ '2017-01-02', #New Year’s Day
36
+ '2017-01-16', #Birthday of Martin Luther King, Jr.
37
+ '2017-02-20', #Washington’s Birthday
38
+ '2017-05-29', #Memorial Day
39
+ '2017-07-04', #Independence Day
40
+ '2017-09-04', #Labor Day
41
+ '2017-10-09', #Columbus Day
42
+ '2017-11-11', #Veterans Day
43
+ '2017-11-23', #Thanksgiving Day
44
+ '2017-12-25' #Christmas Day
45
+ ].map { |d| Date.parse(d) }
46
+ )
47
+ end
48
+
26
49
  end
27
50
 
28
51
  end
29
52
 
30
- context "No Saturday date rolling" do
31
- it 'should determine bank holidays' do
32
- expect(UsBankHolidays::HolidayYear.new(2017).bank_holidays).to eq([
33
- '2017-01-02', #New Year’s Day
34
- '2017-01-16', #Birthday of Martin Luther King, Jr.
35
- '2017-02-20', #Washington’s Birthday
36
- '2017-05-29', #Memorial Day
37
- '2017-07-04', #Independence Day
38
- '2017-09-04', #Labor Day
39
- '2017-10-09', #Columbus Day
40
- '2017-11-11', #Veterans Day
41
- '2017-11-23', #Thanksgiving Day
42
- '2017-12-25' #Christmas Day
43
- ].map {|d| Date.parse(d)}
44
- )
53
+ context "2021 and later" do
54
+
55
+ context "Force Saturday date rolling" do
56
+ before :each do
57
+ allow(::UsBankHolidays).to receive(:saturday_holiday_date_rolling?).and_return(true)
58
+ end
59
+
60
+ it 'should determine bank holidays' do
61
+ expect(UsBankHolidays::HolidayYear.new(2021).bank_holidays).to eq([
62
+ '2021-01-01', #New Year’s Day
63
+ '2021-01-18', #Birthday of Martin Luther King, Jr.
64
+ '2021-02-15', #Washington’s Birthday
65
+ '2021-05-31', #Memorial Day
66
+ '2021-06-18', #Juneteenth
67
+ '2021-07-05', #Independence Day
68
+ '2021-09-06', #Labor Day
69
+ '2021-10-11', #Columbus Day
70
+ '2021-11-11', #Veterans Day
71
+ '2021-11-25', #Thanksgiving Day
72
+ '2021-12-24', #Christmas Day
73
+ '2021-12-31' #New Year’s Day
74
+ ].map { |d| Date.parse(d) }
75
+ )
76
+ end
77
+
45
78
  end
46
79
 
47
- end
80
+ context "No Saturday date rolling" do
81
+ it 'should determine bank holidays' do
82
+ expect(UsBankHolidays::HolidayYear.new(2021).bank_holidays).to eq([
83
+ '2021-01-01', #New Year’s Day
84
+ '2021-01-18', #Birthday of Martin Luther King, Jr.
85
+ '2021-02-15', #Washington’s Birthday
86
+ '2021-05-31', #Memorial Day
87
+ '2021-06-19', #Juneteenth
88
+ '2021-07-05', #Independence Day
89
+ '2021-09-06', #Labor Day
90
+ '2021-10-11', #Columbus Day
91
+ '2021-11-11', #Veterans Day
92
+ '2021-11-25', #Thanksgiving Day
93
+ '2021-12-25', #Christmas Day
94
+ '2021-12-31' #New Year’s Day
95
+ ].map { |d| Date.parse(d) }
96
+ )
97
+ end
48
98
 
99
+ end
100
+
101
+ end
49
102
 
50
103
  end
51
104
 
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe UsBankHolidays::Month do
3
+ RSpec.describe UsBankHolidays::Month do
4
4
  let(:january) { UsBankHolidays::Month.new(2014, 1) }
5
5
 
6
6
  it 'should record the correct month' do
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe UsBankHolidays do
3
+ RSpec.describe UsBankHolidays do
4
4
  let(:sample_holidays) {
5
5
  [
6
6
  '2014-01-01', #New Year’s Day
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_development_dependency 'bundler', '~> 1.3'
21
+ spec.add_development_dependency 'bundler'
22
22
  spec.add_development_dependency 'rake'
23
23
  spec.add_development_dependency 'rspec'
24
24
  spec.add_development_dependency 'simplecov'
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: us_bank_holidays
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arthur Shagall
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-03 00:00:00.000000000 Z
11
+ date: 2021-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.3'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.3'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
107
  version: '0'
108
108
  requirements: []
109
109
  rubyforge_project:
110
- rubygems_version: 2.6.8
110
+ rubygems_version: 2.7.8
111
111
  signing_key:
112
112
  specification_version: 4
113
113
  summary: Patches Date to add methods to make dealing with US bank holidays simpler.