Skip to content

Commit

Permalink
Ensure all tests for load are injecting the fixture path to scan.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jay Shah authored and jaysh committed Sep 21, 2017
1 parent 8415402 commit fcc5d35
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions spec/calendar_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@

describe Business::Calendar do
describe ".load" do
before do
Business::Calendar.additional_load_paths = [
File.join(File.dirname(__FILE__), 'fixtures', 'calendars')
]
end

let(:data_path) { File.join(File.dirname(__FILE__), '..', 'lib', 'business', 'data') }

context "when given a valid calendar" do
Expand All @@ -23,14 +29,7 @@
it { is_expected.to be_a Business::Calendar }
end

load_additional_paths = proc do
Business::Calendar.additional_load_paths = [
File.join(File.dirname(__FILE__), 'fixtures', 'calendars')
]
end

context "when given a calendar from a custom directory" do
before &load_additional_paths
after { Business::Calendar.additional_load_paths = nil }
subject { Business::Calendar.load("ecb") }

Expand Down Expand Up @@ -59,7 +58,6 @@
end

context "when given a calendar that has invalid keys" do
before &load_additional_paths
subject { Business::Calendar.load("invalid-keys") }
specify { expect { subject }.to raise_error("Only valid keys are: holidays, working_days") }
end
Expand Down

0 comments on commit fcc5d35

Please sign in to comment.