Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update gc_ruboconfig requirement from ~> 2.30.0 to ~> 2.31.0 #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion business.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]

spec.add_development_dependency "gc_ruboconfig", "~> 2.30.0"
spec.add_development_dependency "gc_ruboconfig", "~> 2.31.0"
spec.add_development_dependency "rspec", "~> 3.1"
spec.add_development_dependency "rspec_junit_formatter", "~> 0.5.1"
spec.add_development_dependency "rubocop", "~> 1.24.1"
Expand Down
8 changes: 7 additions & 1 deletion lib/business/calendar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,13 @@ def business_days_between(date1, date2)
in_range && on_biz_day
end

remaining_range = (date2 - remaining_days...date2)
num_biz_days += extra_working_dates.count do |extra_day|
in_range = full_weeks_range.cover?(extra_day)
on_weekend = !working_days.include?(extra_day.strftime('%a').downcase)
in_range && on_weekend
end

remaining_range = (date2-remaining_days...date2)
# Loop through each day in remaining_range and count if a business day
num_biz_days + remaining_range.count { |a| business_day?(a) }
end
Expand Down
41 changes: 15 additions & 26 deletions spec/business/calendar_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -624,8 +624,7 @@
context "including business, weekend, holiday days & business date" do
let(:date_1) { "Wed 28/5/2014" }
let(:date_2) { "Thu 12/6/2014" }

it { is_expected.to eq(11) }
it { is_expected.to eq(12) }
end
end

Expand All @@ -647,8 +646,7 @@
context "including business, weekend days, holidays & working date" do
let(:date_1) { "Wed 25/6/2014" }
let(:date_2) { "Tue 8/7/2014" }

it { is_expected.to eq(8) }
it { is_expected.to eq(9) }
end
end
end
Expand Down Expand Up @@ -679,8 +677,7 @@
context "including business, weekend, holilday days & working date" do
let(:date_1) { "Sat 31/5/2014" }
let(:date_2) { "Fri 13/6/2014" }

it { is_expected.to eq(8) }
it { is_expected.to eq(9) }
end
end

Expand All @@ -694,8 +691,7 @@
context "including business, weekend days & working date" do
let(:date_1) { "Sat 31/5/2014" }
let(:date_2) { "Sun 8/6/2014" }

it { is_expected.to be(5) }
it { is_expected.to eql(6) }
end

context "including business, weekend days, and holidays" do
Expand All @@ -706,9 +702,8 @@

context "including business, weekend, holiday days & working date" do
let(:date_1) { "Sat 31/5/2014" }
let(:date_2) { "Sun 14/6/2014" }

it { is_expected.to be(9) }
let(:date_2) { "Sun 15/6/2014" }
it { is_expected.to eql(10) }
end
end

Expand All @@ -722,8 +717,7 @@
context "including business, weekend days & working date" do
let(:date_1) { "Sat 31/5/2014" }
let(:date_2) { "Thu 12/6/2014" }

it { is_expected.to eq(8) }
it { is_expected.to eq(9) }
end
end

Expand All @@ -743,9 +737,8 @@
end

context "including business, weekend days, holidays & working date" do
let(:date_2) { "Tue 13/6/2014" }

it { is_expected.to eq(8) }
let(:date_2) { "Fri 13/6/2014" }
it { is_expected.to eq(9) }
end
end
end
Expand Down Expand Up @@ -804,10 +797,9 @@
end

context "including business/weekend days, holidays & working date" do
let(:date_1) { "27/5/2014" }
let(:date_1) { "Tue 27/5/2014" }
let(:date_2) { "Thu 12/6/2014" }

it { is_expected.to eq(11) }
it { is_expected.to eq(12) }
end
end

Expand Down Expand Up @@ -846,14 +838,12 @@

context "including working date, working & weekend days" do
let(:date_2) { "Tue 10/6/2014" }

it { is_expected.to eq(6) }
it { is_expected.to eq(7) }
end

context "including working date, working & weekend days & holiday" do
let(:date_2) { "Tue 13/6/2014" }

it { is_expected.to eq(8) }
let(:date_2) { "Fri 13/6/2014" }
it { is_expected.to eq(9) }
end
end

Expand Down Expand Up @@ -909,8 +899,7 @@
context "including working dates, weekend & working days" do
let(:date_1) { "Sat 28/6/2014" }
let(:date_2) { "Sat 5/7/2014" }

it { is_expected.to eq(4) }
it { is_expected.to eq(5) }
end
end
end
Expand Down