Skip to content

Commit

Permalink
(puppetlabsGH-768) Remove redundant tests
Browse files Browse the repository at this point in the history
Previously the `ensure_in_module!` tests tested for the various module
directories (lib, tasks and so on).  However this is really just duplicating
the tests for `in_module_root?` which is not required.  This commit removes
these tests and just mocks the response from `in_module_root?`.  This results
in no loss of test coverage.
  • Loading branch information
glennsarti committed Oct 21, 2019
1 parent 59adfda commit 5302c70
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions spec/unit/pdk/cli/util_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,10 @@
context 'when passed :check_module_layout => true' do
let(:options) { { check_module_layout: true } }

%w[manifests lib tasks facts.d functions types].each do |dir|
context "when the current directory contains a '#{dir}' directory" do
before(:each) do
allow(File).to receive(:directory?).with(dir).and_return(true)
end

it 'does not raise an error' do
expect { ensure_in_module }.not_to raise_error
end
context 'when the current directory does contain a module layout' do
it 'raises an error' do
allow(PDK::Util).to receive(:in_module_root?).and_return(true)
expect { ensure_in_module }.not_to raise_error
end
end

Expand Down

0 comments on commit 5302c70

Please sign in to comment.