ae_bank_days 0.0.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +20 -20
- data/LICENSE.txt +1 -1
- data/README.rdoc +3 -3
- data/Rakefile +4 -2
- data/ae_bank_days.gemspec +19 -15
- data/lib/ae_bank_days.rb +5 -30
- data/lib/ae_bank_days/bank_day_helper.rb +40 -0
- data/lib/ae_bank_days/date_extensions.rb +15 -0
- data/lib/ae_bank_days/version.rb +1 -1
- data/test/ae_bank_days/bank_day_helper_test.rb +75 -0
- data/test/ae_bank_days/date_extensions_test.rb +46 -0
- data/test/ae_bank_days_test.rb +9 -0
- data/test/test_helper.rb +20 -0
- metadata +68 -32
- data/test/bank_day_helper_test.rb +0 -42
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06f9983d00ce48e33b4a934f726e456d1eb37daec1355aad31cf605f9c5ef0bd
|
4
|
+
data.tar.gz: e3b17132d6696f57e38e2a1addac13d1ae4daa49fcb788dae5e553b66cec463f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f43ac398011e018ece5207f6db467339a3b9255451627cad5cd5e970b3d08512d38c3ae9d09604ddf09d177a30febdbf98d7e5e5ba6ef8329c9122aea7424e8b
|
7
|
+
data.tar.gz: b0e66f75d0ea3c5ac6d39a7240e3a284af57968292e69a5b14dbfb1753273bc21a425ab9b67e0b8f5bcedffd8bc87a7d77cca0959b6944d0a3d75105087a4c00
|
data/Gemfile.lock
CHANGED
@@ -1,35 +1,35 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ae_bank_days (
|
5
|
-
|
6
|
-
holidays (~> 7.1)
|
4
|
+
ae_bank_days (1.2.0)
|
5
|
+
holidays (~> 8.3)
|
7
6
|
|
8
7
|
GEM
|
9
8
|
remote: https://rubygems.org/
|
10
9
|
specs:
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
rake (12.3.
|
22
|
-
|
23
|
-
tzinfo (1.2.5)
|
24
|
-
thread_safe (~> 0.1)
|
10
|
+
ansi (1.5.0)
|
11
|
+
builder (3.2.4)
|
12
|
+
holidays (8.3.0)
|
13
|
+
minitest (5.11.3)
|
14
|
+
minitest-reporters (1.3.0)
|
15
|
+
ansi
|
16
|
+
builder
|
17
|
+
minitest (>= 5.0)
|
18
|
+
ruby-progressbar
|
19
|
+
mocha (1.11.2)
|
20
|
+
rake (12.3.3)
|
21
|
+
ruby-progressbar (1.10.1)
|
25
22
|
|
26
23
|
PLATFORMS
|
27
24
|
ruby
|
28
25
|
|
29
26
|
DEPENDENCIES
|
30
27
|
ae_bank_days!
|
31
|
-
bundler (>= 1.10.4, <
|
32
|
-
|
28
|
+
bundler (>= 1.10.4, < 3)
|
29
|
+
minitest (>= 5.8)
|
30
|
+
minitest-reporters (>= 1.3)
|
31
|
+
mocha (>= 1.1)
|
32
|
+
rake (>= 12.0)
|
33
33
|
|
34
34
|
BUNDLED WITH
|
35
|
-
2.
|
35
|
+
2.1.4
|
data/LICENSE.txt
CHANGED
data/README.rdoc
CHANGED
@@ -9,9 +9,9 @@ Simple utility to find the next banking day
|
|
9
9
|
* Fork the project.
|
10
10
|
* Start a feature/bugfix branch.
|
11
11
|
* Commit and push until you are happy with your contribution.
|
12
|
-
* Make sure to add tests for it. This is important so
|
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
|
12
|
+
* Make sure to add tests for it. This is important so it doesn't break 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 it can be cherry-picked around.
|
14
14
|
|
15
15
|
== Copyright
|
16
16
|
|
17
|
-
Copyright © 2019 AppFolio.
|
17
|
+
Copyright © 2019-2020 AppFolio.
|
data/Rakefile
CHANGED
@@ -2,13 +2,15 @@
|
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'bundler'
|
5
|
+
|
5
6
|
begin
|
6
7
|
Bundler.setup(:default, :development)
|
7
8
|
rescue Bundler::BundlerError => e
|
8
|
-
|
9
|
-
|
9
|
+
warn e.message
|
10
|
+
warn 'Run `bundle install` to install missing gems'
|
10
11
|
exit e.status_code
|
11
12
|
end
|
13
|
+
|
12
14
|
require 'rake/testtask'
|
13
15
|
|
14
16
|
Rake::TestTask.new(:test) do |test|
|
data/ae_bank_days.gemspec
CHANGED
@@ -5,23 +5,27 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
require 'ae_bank_days/version'
|
6
6
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
|
-
spec.name
|
9
|
-
spec.version
|
10
|
-
spec.
|
11
|
-
spec.
|
12
|
-
spec.
|
13
|
-
spec.
|
14
|
-
spec.
|
8
|
+
spec.name = 'ae_bank_days'
|
9
|
+
spec.version = AeBankDays::VERSION
|
10
|
+
spec.platform = Gem::Platform::RUBY
|
11
|
+
spec.authors = ['AppFolio']
|
12
|
+
spec.email = ['dev@appfolio.com']
|
13
|
+
spec.summary = 'Gem for finding the next banking date'
|
14
|
+
spec.description = spec.summary
|
15
|
+
spec.homepage = 'http://github.com/appfolio/ae_bank_days'
|
15
16
|
spec.required_ruby_version = ['>= 2.3.3', '< 2.7']
|
16
|
-
spec.licenses
|
17
|
+
spec.licenses = ['MIT']
|
18
|
+
spec.files = Dir['**/*'].reject { |f| f[%r{^log/}] || f[%r{^pkg/}] }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test)/})
|
20
|
+
spec.require_paths = ['lib']
|
21
|
+
|
17
22
|
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
18
23
|
|
19
|
-
spec.
|
20
|
-
spec.test_files = spec.files.grep(%r{^(test)/})
|
21
|
-
spec.require_paths = ['lib']
|
24
|
+
spec.add_dependency('holidays', '~> 8.3')
|
22
25
|
|
23
|
-
spec.
|
24
|
-
spec.
|
25
|
-
spec.add_development_dependency
|
26
|
-
spec.add_development_dependency
|
26
|
+
spec.add_development_dependency('bundler', ['>= 1.10.4', '< 3'])
|
27
|
+
spec.add_development_dependency('minitest', '>= 5.8')
|
28
|
+
spec.add_development_dependency('minitest-reporters', '>= 1.3')
|
29
|
+
spec.add_development_dependency('mocha', '>= 1.1')
|
30
|
+
spec.add_development_dependency('rake', '>= 12.0')
|
27
31
|
end
|
data/lib/ae_bank_days.rb
CHANGED
@@ -1,36 +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
|
-
ten_years_from_now = Time.now + 10.years
|
13
|
-
HOLIDAYS = Holidays.between(Date.civil(2014, 1, 1), ten_years_from_now, :federalreserve, :observed).map do |holiday|
|
14
|
-
holiday[:date]
|
15
|
-
end
|
16
|
-
|
17
|
-
class << self
|
18
|
-
def bank_day?(day)
|
19
|
-
date = day.to_date
|
20
|
-
weekday?(date) && !HOLIDAYS.include?(date)
|
21
|
-
end
|
22
|
-
|
23
|
-
def next_banking_day(date)
|
24
|
-
banking_day = date
|
25
|
-
banking_day += 1 until bank_day?(banking_day)
|
26
|
-
banking_day
|
27
|
-
end
|
28
|
-
|
29
|
-
private
|
30
|
-
|
31
|
-
def weekday?(day)
|
32
|
-
[1, 2, 3, 4, 5].include? day.wday
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
7
|
+
autoload :BankDayHelper, 'ae_bank_days/bank_day_helper'
|
8
|
+
autoload :DateExtensions, 'ae_bank_days/date_extensions'
|
36
9
|
end
|
10
|
+
|
11
|
+
Date.send :include, AeBankDays::DateExtensions
|
@@ -0,0 +1,40 @@
|
|
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
|
15
|
+
number_of_days.times do
|
16
|
+
banking_day += 1 until bank_day?(banking_day)
|
17
|
+
banking_day += 1
|
18
|
+
end
|
19
|
+
banking_day += 1 until bank_day?(banking_day)
|
20
|
+
banking_day
|
21
|
+
end
|
22
|
+
|
23
|
+
def previous_banking_day(date, number_of_days: 0)
|
24
|
+
banking_day = date
|
25
|
+
number_of_days.times do
|
26
|
+
banking_day -= 1 until bank_day?(banking_day)
|
27
|
+
banking_day -= 1
|
28
|
+
end
|
29
|
+
banking_day -= 1 until bank_day?(banking_day)
|
30
|
+
banking_day
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def weekday?(day)
|
36
|
+
(1..5).include?(day.wday)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
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
@@ -0,0 +1,75 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_helper'
|
4
|
+
|
5
|
+
module AeBankDays
|
6
|
+
class BankDayHelperTest < Minitest::Test
|
7
|
+
def test_bank_day__weekday
|
8
|
+
assert BankDayHelper.bank_day?(Date.civil(2017, 10, 3))
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_bank_day__weekend
|
12
|
+
refute BankDayHelper.bank_day?(Date.civil(2017, 10, 14))
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_bank_day__holiday
|
16
|
+
refute BankDayHelper.bank_day?(Date.civil(2017, 10, 9))
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_bank_day__saturday_holiday_is_not_observed_on_friday
|
20
|
+
# The federal bank does not observe holidays that fall on Saturday on the preceding Friday as is common.
|
21
|
+
# This test makes sure that these dates are not accidentally marked as holidays.
|
22
|
+
# July 4, 2020 fell on a Saturday. The day before was a generally observed federal holiday, but it was still
|
23
|
+
# a banking day due to the federal banks holiday rules.
|
24
|
+
assert BankDayHelper.bank_day?(Date.civil(2020, 6, 3))
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_next_banking_day__weekday
|
28
|
+
assert_equal Date.civil(2017, 10, 3), BankDayHelper.next_banking_day(Date.civil(2017, 10, 3))
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_next_banking_day__weekday__extra_days
|
32
|
+
assert_equal Date.civil(2017, 10, 6), BankDayHelper.next_banking_day(Date.civil(2017, 10, 3), number_of_days: 3)
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_next_banking_day__weekend
|
36
|
+
assert_equal Date.civil(2017, 10, 16), BankDayHelper.next_banking_day(Date.civil(2017, 10, 14))
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_next_banking_day__weekend__extra_days
|
40
|
+
assert_equal Date.civil(2017, 10, 19), BankDayHelper.next_banking_day(Date.civil(2017, 10, 14), number_of_days: 3)
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_next_banking_day__holiday
|
44
|
+
assert_equal Date.civil(2017, 10, 10), BankDayHelper.next_banking_day(Date.civil(2017, 10, 9))
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_next_banking_day__holiday__extra_days
|
48
|
+
assert_equal Date.civil(2017, 10, 13), BankDayHelper.next_banking_day(Date.civil(2017, 10, 9), number_of_days: 3)
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_previous_banking_day__weekday
|
52
|
+
assert_equal Date.civil(2017, 10, 3), BankDayHelper.previous_banking_day(Date.civil(2017, 10, 3))
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_previous_banking_day__weekday__extra_days
|
56
|
+
assert_equal Date.civil(2017, 10, 3), BankDayHelper.previous_banking_day(Date.civil(2017, 10, 6), number_of_days: 3)
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_previous_banking_day__weekend
|
60
|
+
assert_equal Date.civil(2017, 10, 13), BankDayHelper.previous_banking_day(Date.civil(2017, 10, 14))
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_previous_banking_day__weekend__extra_days
|
64
|
+
assert_equal Date.civil(2017, 10, 10), BankDayHelper.previous_banking_day(Date.civil(2017, 10, 14), number_of_days: 3)
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_previous_banking_day__holiday
|
68
|
+
assert_equal Date.civil(2017, 10, 6), BankDayHelper.previous_banking_day(Date.civil(2017, 10, 9))
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_previous_banking_day__holiday__extra_days
|
72
|
+
assert_equal Date.civil(2017, 10, 3), BankDayHelper.previous_banking_day(Date.civil(2017, 10, 9), number_of_days: 3)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_helper'
|
4
|
+
|
5
|
+
module AeBankDays
|
6
|
+
class DateExtensionsTest < Minitest::Test
|
7
|
+
def test_bank_day
|
8
|
+
date = Date.today
|
9
|
+
BankDayHelper.expects(:bank_day?).with(date).returns(true)
|
10
|
+
|
11
|
+
assert date.bank_day?
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_next_banking_day
|
15
|
+
date = Date.today
|
16
|
+
new_date = date + 2
|
17
|
+
BankDayHelper.expects(:next_banking_day).with(date, number_of_days: 2).returns(new_date)
|
18
|
+
|
19
|
+
assert_equal new_date, date.next_banking_day(2)
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_next_banking_day__default
|
23
|
+
date = Date.today
|
24
|
+
new_date = date + 2
|
25
|
+
BankDayHelper.expects(:next_banking_day).with(date, number_of_days: 0).returns(new_date)
|
26
|
+
|
27
|
+
assert_equal new_date, date.next_banking_day
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_previous_banking_day
|
31
|
+
date = Date.today
|
32
|
+
new_date = date + 2
|
33
|
+
BankDayHelper.expects(:previous_banking_day).with(date, number_of_days: 2).returns(new_date)
|
34
|
+
|
35
|
+
assert_equal new_date, date.previous_banking_day(2)
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_previous_banking_day__default
|
39
|
+
date = Date.today
|
40
|
+
new_date = date + 2
|
41
|
+
BankDayHelper.expects(:previous_banking_day).with(date, number_of_days: 0).returns(new_date)
|
42
|
+
|
43
|
+
assert_equal new_date, date.previous_banking_day
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
|
6
|
+
begin
|
7
|
+
Bundler.setup(:default, :development)
|
8
|
+
rescue Bundler::BundlerError => e
|
9
|
+
warn e.message
|
10
|
+
warn 'Run `bundle install` to install missing gems'
|
11
|
+
exit e.status_code
|
12
|
+
end
|
13
|
+
|
14
|
+
require 'ae_bank_days'
|
15
|
+
require 'minitest/autorun'
|
16
|
+
require 'minitest/reporters'
|
17
|
+
require 'mocha/setup'
|
18
|
+
require 'time'
|
19
|
+
|
20
|
+
MiniTest::Reporters.use!
|
metadata
CHANGED
@@ -1,78 +1,106 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ae_bank_days
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.2.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: 2020-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: holidays
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '8.3'
|
20
20
|
type: :runtime
|
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: '
|
26
|
+
version: '8.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
34
|
-
|
33
|
+
version: 1.10.4
|
34
|
+
- - "<"
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '3'
|
37
|
+
type: :development
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
38
|
-
- - "
|
41
|
+
- - ">="
|
39
42
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
43
|
+
version: 1.10.4
|
44
|
+
- - "<"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '3'
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
48
|
+
name: minitest
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
|
-
- - "
|
51
|
+
- - ">="
|
46
52
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
53
|
+
version: '5.8'
|
48
54
|
type: :development
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
51
57
|
requirements:
|
52
|
-
- - "
|
58
|
+
- - ">="
|
53
59
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
60
|
+
version: '5.8'
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
62
|
+
name: minitest-reporters
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
58
64
|
requirements:
|
59
65
|
- - ">="
|
60
66
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.
|
62
|
-
|
67
|
+
version: '1.3'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
63
73
|
- !ruby/object:Gem::Version
|
64
|
-
version: '
|
74
|
+
version: '1.3'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: mocha
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '1.1'
|
65
82
|
type: :development
|
66
83
|
prerelease: false
|
67
84
|
version_requirements: !ruby/object:Gem::Requirement
|
68
85
|
requirements:
|
69
86
|
- - ">="
|
70
87
|
- !ruby/object:Gem::Version
|
71
|
-
version: 1.
|
72
|
-
|
88
|
+
version: '1.1'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: rake
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
73
94
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
75
|
-
|
95
|
+
version: '12.0'
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '12.0'
|
103
|
+
description: Gem for finding the next banking date
|
76
104
|
email:
|
77
105
|
- dev@appfolio.com
|
78
106
|
executables: []
|
@@ -86,14 +114,19 @@ files:
|
|
86
114
|
- Rakefile
|
87
115
|
- ae_bank_days.gemspec
|
88
116
|
- lib/ae_bank_days.rb
|
117
|
+
- lib/ae_bank_days/bank_day_helper.rb
|
118
|
+
- lib/ae_bank_days/date_extensions.rb
|
89
119
|
- lib/ae_bank_days/version.rb
|
90
|
-
- test/bank_day_helper_test.rb
|
120
|
+
- test/ae_bank_days/bank_day_helper_test.rb
|
121
|
+
- test/ae_bank_days/date_extensions_test.rb
|
122
|
+
- test/ae_bank_days_test.rb
|
123
|
+
- test/test_helper.rb
|
91
124
|
homepage: http://github.com/appfolio/ae_bank_days
|
92
125
|
licenses:
|
93
126
|
- MIT
|
94
127
|
metadata:
|
95
128
|
allowed_push_host: https://rubygems.org
|
96
|
-
post_install_message:
|
129
|
+
post_install_message:
|
97
130
|
rdoc_options: []
|
98
131
|
require_paths:
|
99
132
|
- lib
|
@@ -111,9 +144,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
144
|
- !ruby/object:Gem::Version
|
112
145
|
version: '0'
|
113
146
|
requirements: []
|
114
|
-
rubygems_version: 3.0.
|
115
|
-
signing_key:
|
147
|
+
rubygems_version: 3.0.3
|
148
|
+
signing_key:
|
116
149
|
specification_version: 4
|
117
150
|
summary: Gem for finding the next banking date
|
118
151
|
test_files:
|
119
|
-
- test/bank_day_helper_test.rb
|
152
|
+
- test/ae_bank_days/bank_day_helper_test.rb
|
153
|
+
- test/ae_bank_days/date_extensions_test.rb
|
154
|
+
- test/ae_bank_days_test.rb
|
155
|
+
- test/test_helper.rb
|
@@ -1,42 +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__weekend
|
33
|
-
time = Time.parse('2017-10-14 14:30:45 -0500')
|
34
|
-
assert_equal Date.parse('2017-10-16'), AeBankDays::BankDayHelper.next_banking_day(time.to_date)
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_next_banking_day__holiday
|
38
|
-
time = Time.parse('2017-10-09 14:30:45 -0500')
|
39
|
-
assert_equal Date.parse('2017-10-10'), AeBankDays::BankDayHelper.next_banking_day(time.to_date)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|