ae_bank_days 1.1.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +9 -1
- data/README.md +25 -0
- data/Rakefile +4 -3
- data/ae_bank_days.gemspec +16 -20
- data/lib/ae_bank_days.rb +5 -43
- data/lib/ae_bank_days/bank_day_helper.rb +54 -0
- data/lib/ae_bank_days/date_extensions.rb +15 -0
- data/lib/ae_bank_days/version.rb +1 -1
- metadata +14 -68
- data/Gemfile.lock +0 -35
- data/LICENSE.txt +0 -20
- data/README.rdoc +0 -17
- data/ae_bank_days-1.0.0.gem +0 -0
- data/test/bank_day_helper_test.rb +0 -87
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af37f7836eec42406fe3a2c1c86f3079f0b3ee95261020e770a8b3aa960ce524
|
4
|
+
data.tar.gz: 50fe48b765afdb9f3675934b157d809490b74985ce74e3a1fdd52428f28ccd9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a9b58a38b414c355268fcd982e232e216d4c8fe0ade9da1a6218e1c41e8cca852e3bcf6ae6b1d6cdae8013400006735eda668378237398ebc9016a7cfd7da79
|
7
|
+
data.tar.gz: c4fc232b7874a6d4c6be98c6860e189f7ab156821b61d3eb56b57371384b07acb96934c299fbd24268cebb46d8900e45242fabd43a76f80fe461fd5b11b81357
|
data/Gemfile
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
source 'https://rubygems.org'
|
3
|
+
source 'https://rubygems.org' do
|
4
|
+
gem 'appraisal', '>= 2.3', '< 3'
|
5
|
+
gem 'bundler', '>= 1.10.4', '< 3'
|
6
|
+
gem 'minitest', '>= 5.8', '< 6'
|
7
|
+
gem 'minitest-reporters', '>= 1.4', '< 2'
|
8
|
+
gem 'mocha', '>= 1.11', '< 2'
|
9
|
+
gem 'rake', '>= 13', '< 14'
|
10
|
+
gem 'simplecov', '>= 0.18', '< 1', group: :test, require: false
|
11
|
+
end
|
4
12
|
|
5
13
|
gemspec
|
data/README.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# AeBankDays
|
2
|
+
|
3
|
+
Simple utility to find the next banking day
|
4
|
+
|
5
|
+
## Running Tests
|
6
|
+
|
7
|
+
Use the appraisal gem to test different versions of Ruby to ensure changes are compatible. Run them with the
|
8
|
+
following command with the different versions of Ruby set:
|
9
|
+
|
10
|
+
`bundle exec appraisal rake test`
|
11
|
+
|
12
|
+
For a more detailed output that includes total coverage use:
|
13
|
+
|
14
|
+
`WITH_COVERAGE=true bundle exec rake test`
|
15
|
+
|
16
|
+
## Contributing to AeBankDays
|
17
|
+
|
18
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
19
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
20
|
+
* Fork the project.
|
21
|
+
* Start a feature/bugfix branch.
|
22
|
+
* Commit and push until you are happy with your contribution.
|
23
|
+
* Make sure to add tests for it. This is important so it doesn't break in a future version unintentionally.
|
24
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise
|
25
|
+
necessary, that is fine, but please isolate to its own commit so it can be cherry-picked around.
|
data/Rakefile
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'rubygems'
|
4
3
|
require 'bundler'
|
4
|
+
|
5
5
|
begin
|
6
6
|
Bundler.setup(:default, :development)
|
7
7
|
rescue Bundler::BundlerError => e
|
8
|
-
|
9
|
-
|
8
|
+
warn e.message
|
9
|
+
warn 'Run `bundle install` to install missing gems'
|
10
10
|
exit e.status_code
|
11
11
|
end
|
12
|
+
|
12
13
|
require 'rake/testtask'
|
13
14
|
|
14
15
|
Rake::TestTask.new(:test) do |test|
|
data/ae_bank_days.gemspec
CHANGED
@@ -1,27 +1,23 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
require 'ae_bank_days/version'
|
3
|
+
require_relative 'lib/ae_bank_days/version'
|
6
4
|
|
7
5
|
Gem::Specification.new do |spec|
|
8
|
-
spec.name
|
9
|
-
spec.version
|
10
|
-
spec.
|
11
|
-
spec.
|
12
|
-
spec.
|
13
|
-
spec.
|
14
|
-
spec.
|
15
|
-
spec.
|
16
|
-
spec.
|
17
|
-
spec.
|
6
|
+
spec.name = 'ae_bank_days'
|
7
|
+
spec.version = AeBankDays::VERSION
|
8
|
+
spec.platform = Gem::Platform::RUBY
|
9
|
+
spec.authors = ['AppFolio']
|
10
|
+
spec.email = ['dev@appfolio.com']
|
11
|
+
spec.summary = 'Gem for finding the next banking date'
|
12
|
+
spec.description = spec.summary
|
13
|
+
spec.homepage = 'https://github.com/appfolio/ae_bank_days'
|
14
|
+
spec.required_ruby_version = '>= 2.3.3'
|
15
|
+
spec.licenses = ['MIT']
|
16
|
+
spec.files = Dir['**/*'].select { |f| f[%r{^(lib/|Gemfile$|Rakefile|README.md|.*gemspec)}] }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test)/})
|
18
|
+
spec.require_paths = ['lib']
|
18
19
|
|
19
|
-
spec.
|
20
|
-
spec.test_files = spec.files.grep(%r{^(test)/})
|
21
|
-
spec.require_paths = ['lib']
|
20
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
22
21
|
|
23
|
-
spec.add_dependency
|
24
|
-
spec.add_dependency 'holidays', '~> 7.1'
|
25
|
-
spec.add_development_dependency 'rake', '~> 12.0'
|
26
|
-
spec.add_development_dependency 'bundler', ['>= 1.10.4', '< 2.1']
|
22
|
+
spec.add_dependency('holidays', '~> 8.3')
|
27
23
|
end
|
data/lib/ae_bank_days.rb
CHANGED
@@ -1,49 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'date'
|
4
4
|
require 'holidays'
|
5
|
-
require 'active_support'
|
6
|
-
require 'active_support/core_ext/time'
|
7
|
-
require 'active_support/core_ext/integer/time'
|
8
5
|
|
9
6
|
module AeBankDays
|
10
|
-
|
11
|
-
|
12
|
-
HOLIDAYS = Holidays.between(Date.civil(2014, 1, 1), ten_years_from_now, :federalreserve, :observed).map do |holiday|
|
13
|
-
holiday[:date]
|
14
|
-
end
|
15
|
-
|
16
|
-
class << self
|
17
|
-
def bank_day?(day)
|
18
|
-
date = day.to_date
|
19
|
-
weekday?(date) && !HOLIDAYS.include?(date)
|
20
|
-
end
|
21
|
-
|
22
|
-
def next_banking_day(date, number_of_days: 0)
|
23
|
-
banking_day = date
|
24
|
-
number_of_days.times do
|
25
|
-
banking_day += 1 until bank_day?(banking_day)
|
26
|
-
banking_day += 1
|
27
|
-
end
|
28
|
-
banking_day += 1 until bank_day?(banking_day)
|
29
|
-
banking_day
|
30
|
-
end
|
31
|
-
|
32
|
-
def previous_banking_day(date, number_of_days: 0)
|
33
|
-
banking_day = date
|
34
|
-
number_of_days.times do
|
35
|
-
banking_day -= 1 until bank_day?(banking_day)
|
36
|
-
banking_day -= 1
|
37
|
-
end
|
38
|
-
banking_day -= 1 until bank_day?(banking_day)
|
39
|
-
banking_day
|
40
|
-
end
|
41
|
-
|
42
|
-
private
|
43
|
-
|
44
|
-
def weekday?(day)
|
45
|
-
[1, 2, 3, 4, 5].include? day.wday
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
7
|
+
autoload :BankDayHelper, 'ae_bank_days/bank_day_helper'
|
8
|
+
autoload :DateExtensions, 'ae_bank_days/date_extensions'
|
49
9
|
end
|
10
|
+
|
11
|
+
Date.send :include, AeBankDays::DateExtensions
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AeBankDays
|
4
|
+
class BankDayHelper
|
5
|
+
class << self
|
6
|
+
Holidays.cache_between(Date.today.prev_year, Date.today.next_year(10), :federalreservebanks, :observed)
|
7
|
+
|
8
|
+
def bank_day?(day)
|
9
|
+
date = day.to_date
|
10
|
+
weekday?(date) && Holidays.on(date, :federalreservebanks, :observed).empty?
|
11
|
+
end
|
12
|
+
|
13
|
+
def next_banking_day(date, number_of_days: 0)
|
14
|
+
banking_day = date.to_date
|
15
|
+
banking_day += 1
|
16
|
+
number_of_days.times do
|
17
|
+
banking_day = current_or_next_banking_day(banking_day)
|
18
|
+
banking_day += 1
|
19
|
+
end
|
20
|
+
|
21
|
+
current_or_next_banking_day(banking_day)
|
22
|
+
end
|
23
|
+
|
24
|
+
def previous_banking_day(date, number_of_days: 0)
|
25
|
+
banking_day = date.to_date
|
26
|
+
banking_day -= 1
|
27
|
+
number_of_days.times do
|
28
|
+
banking_day = current_or_previous_banking_day(banking_day)
|
29
|
+
banking_day -= 1
|
30
|
+
end
|
31
|
+
|
32
|
+
current_or_previous_banking_day(banking_day)
|
33
|
+
end
|
34
|
+
|
35
|
+
def current_or_previous_banking_day(day)
|
36
|
+
date = day.to_date
|
37
|
+
date -= 1 until bank_day?(date)
|
38
|
+
date
|
39
|
+
end
|
40
|
+
|
41
|
+
def current_or_next_banking_day(day)
|
42
|
+
date = day.to_date
|
43
|
+
date += 1 until bank_day?(date)
|
44
|
+
date
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def weekday?(day)
|
50
|
+
(1..5).include?(day.wday)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module AeBankDays
|
2
|
+
module DateExtensions
|
3
|
+
def bank_day?
|
4
|
+
BankDayHelper.bank_day?(self)
|
5
|
+
end
|
6
|
+
|
7
|
+
def next_banking_day(n = 0)
|
8
|
+
BankDayHelper.next_banking_day(self, number_of_days: n)
|
9
|
+
end
|
10
|
+
|
11
|
+
def previous_banking_day(n = 0)
|
12
|
+
BankDayHelper.previous_banking_day(self, number_of_days: n)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/ae_bank_days/version.rb
CHANGED
metadata
CHANGED
@@ -1,78 +1,30 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ae_bank_days
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AppFolio
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: activesupport
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "<"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '5.3'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "<"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '5.3'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: holidays
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
30
16
|
requirements:
|
31
17
|
- - "~>"
|
32
18
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
19
|
+
version: '8.3'
|
34
20
|
type: :runtime
|
35
21
|
prerelease: false
|
36
22
|
version_requirements: !ruby/object:Gem::Requirement
|
37
23
|
requirements:
|
38
24
|
- - "~>"
|
39
25
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
41
|
-
|
42
|
-
name: rake
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '12.0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '12.0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: bundler
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 1.10.4
|
62
|
-
- - "<"
|
63
|
-
- !ruby/object:Gem::Version
|
64
|
-
version: '2.1'
|
65
|
-
type: :development
|
66
|
-
prerelease: false
|
67
|
-
version_requirements: !ruby/object:Gem::Requirement
|
68
|
-
requirements:
|
69
|
-
- - ">="
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
version: 1.10.4
|
72
|
-
- - "<"
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
version: '2.1'
|
75
|
-
description: ''
|
26
|
+
version: '8.3'
|
27
|
+
description: Gem for finding the next banking date
|
76
28
|
email:
|
77
29
|
- dev@appfolio.com
|
78
30
|
executables: []
|
@@ -80,21 +32,19 @@ extensions: []
|
|
80
32
|
extra_rdoc_files: []
|
81
33
|
files:
|
82
34
|
- Gemfile
|
83
|
-
-
|
84
|
-
- LICENSE.txt
|
85
|
-
- README.rdoc
|
35
|
+
- README.md
|
86
36
|
- Rakefile
|
87
|
-
- ae_bank_days-1.0.0.gem
|
88
37
|
- ae_bank_days.gemspec
|
89
38
|
- lib/ae_bank_days.rb
|
39
|
+
- lib/ae_bank_days/bank_day_helper.rb
|
40
|
+
- lib/ae_bank_days/date_extensions.rb
|
90
41
|
- lib/ae_bank_days/version.rb
|
91
|
-
|
92
|
-
homepage: http://github.com/appfolio/ae_bank_days
|
42
|
+
homepage: https://github.com/appfolio/ae_bank_days
|
93
43
|
licenses:
|
94
44
|
- MIT
|
95
45
|
metadata:
|
96
46
|
allowed_push_host: https://rubygems.org
|
97
|
-
post_install_message:
|
47
|
+
post_install_message:
|
98
48
|
rdoc_options: []
|
99
49
|
require_paths:
|
100
50
|
- lib
|
@@ -103,18 +53,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
103
53
|
- - ">="
|
104
54
|
- !ruby/object:Gem::Version
|
105
55
|
version: 2.3.3
|
106
|
-
- - "<"
|
107
|
-
- !ruby/object:Gem::Version
|
108
|
-
version: '2.7'
|
109
56
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
57
|
requirements:
|
111
58
|
- - ">="
|
112
59
|
- !ruby/object:Gem::Version
|
113
60
|
version: '0'
|
114
61
|
requirements: []
|
115
|
-
rubygems_version: 3.
|
116
|
-
signing_key:
|
62
|
+
rubygems_version: 3.1.2
|
63
|
+
signing_key:
|
117
64
|
specification_version: 4
|
118
65
|
summary: Gem for finding the next banking date
|
119
|
-
test_files:
|
120
|
-
- test/bank_day_helper_test.rb
|
66
|
+
test_files: []
|
data/Gemfile.lock
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
ae_bank_days (1.0.0)
|
5
|
-
activesupport (< 5.3)
|
6
|
-
holidays (~> 7.1)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
11
|
-
activesupport (5.2.3)
|
12
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
13
|
-
i18n (>= 0.7, < 2)
|
14
|
-
minitest (~> 5.1)
|
15
|
-
tzinfo (~> 1.1)
|
16
|
-
concurrent-ruby (1.1.5)
|
17
|
-
holidays (7.1.0)
|
18
|
-
i18n (1.7.0)
|
19
|
-
concurrent-ruby (~> 1.0)
|
20
|
-
minitest (5.13.0)
|
21
|
-
rake (12.3.2)
|
22
|
-
thread_safe (0.3.6)
|
23
|
-
tzinfo (1.2.5)
|
24
|
-
thread_safe (~> 0.1)
|
25
|
-
|
26
|
-
PLATFORMS
|
27
|
-
ruby
|
28
|
-
|
29
|
-
DEPENDENCIES
|
30
|
-
ae_bank_days!
|
31
|
-
bundler (>= 1.10.4, < 2.1)
|
32
|
-
rake (~> 12.0)
|
33
|
-
|
34
|
-
BUNDLED WITH
|
35
|
-
2.0.2
|
data/LICENSE.txt
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2019 AppFolio inc
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
= ae_bank_days
|
2
|
-
|
3
|
-
Simple utility to find the next banking day
|
4
|
-
|
5
|
-
== Contributing to ae_bank_days
|
6
|
-
|
7
|
-
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
8
|
-
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
9
|
-
* Fork the project.
|
10
|
-
* Start a feature/bugfix branch.
|
11
|
-
* Commit and push until you are happy with your contribution.
|
12
|
-
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
-
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
14
|
-
|
15
|
-
== Copyright
|
16
|
-
|
17
|
-
Copyright © 2019 AppFolio.
|
data/ae_bank_days-1.0.0.gem
DELETED
Binary file
|
@@ -1,87 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'minitest/autorun'
|
4
|
-
require 'ae_bank_days'
|
5
|
-
|
6
|
-
module AeBankDays
|
7
|
-
class BankDayHelperTest < ActiveSupport::TestCase
|
8
|
-
def test_constant
|
9
|
-
refute AeBankDays::BankDayHelper::HOLIDAYS.empty?
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_bank_day__weekday
|
13
|
-
time = Time.parse('2017-10-03 14:30:45 -0500')
|
14
|
-
assert AeBankDays::BankDayHelper.bank_day?(time.to_date)
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_bank_day__weekend
|
18
|
-
time = Time.parse('2017-10-14 14:30:45 -0500')
|
19
|
-
refute AeBankDays::BankDayHelper.bank_day?(time.to_date)
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_bank_day__holiday
|
23
|
-
time = Time.parse('2017-10-09 14:30:45 -0500')
|
24
|
-
refute AeBankDays::BankDayHelper.bank_day?(time.to_date)
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_next_banking_day__weekday
|
28
|
-
time = Time.parse('2017-10-03 14:30:45 -0500')
|
29
|
-
assert_equal Date.parse('2017-10-03'), AeBankDays::BankDayHelper.next_banking_day(time.to_date)
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_next_banking_day__weekday__extra_days
|
33
|
-
time = Time.parse('2017-10-03 14:30:45 -0500')
|
34
|
-
assert_equal Date.parse('2017-10-06'), AeBankDays::BankDayHelper.next_banking_day(time.to_date, number_of_days: 3)
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_next_banking_day__weekend
|
38
|
-
time = Time.parse('2017-10-14 14:30:45 -0500')
|
39
|
-
assert_equal Date.parse('2017-10-16'), AeBankDays::BankDayHelper.next_banking_day(time.to_date)
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_next_banking_day__weekend__extra_days
|
43
|
-
time = Time.parse('2017-10-14 14:30:45 -0500')
|
44
|
-
assert_equal Date.parse('2017-10-19'), AeBankDays::BankDayHelper.next_banking_day(time.to_date, number_of_days: 3)
|
45
|
-
end
|
46
|
-
|
47
|
-
def test_next_banking_day__holiday
|
48
|
-
time = Time.parse('2017-10-09 14:30:45 -0500')
|
49
|
-
assert_equal Date.parse('2017-10-10'), AeBankDays::BankDayHelper.next_banking_day(time.to_date)
|
50
|
-
end
|
51
|
-
|
52
|
-
def test_next_banking_day__holiday__extra_days
|
53
|
-
time = Time.parse('2017-10-09 14:30:45 -0500')
|
54
|
-
assert_equal Date.parse('2017-10-13'), AeBankDays::BankDayHelper.next_banking_day(time.to_date, number_of_days: 3)
|
55
|
-
end
|
56
|
-
|
57
|
-
def test_previous_banking_day__weekday
|
58
|
-
time = Time.parse('2017-10-03 14:30:45 -0500')
|
59
|
-
assert_equal Date.parse('2017-10-03'), AeBankDays::BankDayHelper.previous_banking_day(time.to_date)
|
60
|
-
end
|
61
|
-
|
62
|
-
def test_previous_banking_day__weekday__extra_days
|
63
|
-
time = Time.parse('2017-10-06 14:30:45 -0500')
|
64
|
-
assert_equal Date.parse('2017-10-03'), AeBankDays::BankDayHelper.previous_banking_day(time.to_date, number_of_days: 3)
|
65
|
-
end
|
66
|
-
|
67
|
-
def test_previous_banking_day__weekend
|
68
|
-
time = Time.parse('2017-10-14 14:30:45 -0500')
|
69
|
-
assert_equal Date.parse('2017-10-13'), AeBankDays::BankDayHelper.previous_banking_day(time.to_date)
|
70
|
-
end
|
71
|
-
|
72
|
-
def test_previous_banking_day__weekend__extra_days
|
73
|
-
time = Time.parse('2017-10-14 14:30:45 -0500')
|
74
|
-
assert_equal Date.parse('2017-10-10'), AeBankDays::BankDayHelper.previous_banking_day(time.to_date, number_of_days: 3)
|
75
|
-
end
|
76
|
-
|
77
|
-
def test_previous_banking_day__holiday
|
78
|
-
time = Time.parse('2017-10-09 14:30:45 -0500')
|
79
|
-
assert_equal Date.parse('2017-10-06'), AeBankDays::BankDayHelper.previous_banking_day(time.to_date)
|
80
|
-
end
|
81
|
-
|
82
|
-
def test_previous_banking_day__holiday__extra_days
|
83
|
-
time = Time.parse('2017-10-09 14:30:45 -0500')
|
84
|
-
assert_equal Date.parse('2017-10-03'), AeBankDays::BankDayHelper.previous_banking_day(time.to_date, number_of_days: 3)
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|