Skip to content

Commit

Permalink
(fixup) Fixes up validation spec tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bmjen committed Jun 21, 2017
1 parent 1dad994 commit fe10bf8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions spec/cli/validate_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

context 'when no arguments or options are provided' do
it 'invokes each validator with no report and no options and exits zero' do
allow(PDK::Util).to receive(:module_root).and_return('.')
validators.each do |validator|
expect(validator).to receive(:invoke).with(instance_of(PDK::Report), {}).and_return(0)
end
Expand Down Expand Up @@ -40,6 +41,7 @@
let(:validator) { PDK::Validate::Metadata }

it 'only invokes the given validator and exits zero' do
allow(PDK::Util).to receive(:module_root).and_return('.')
expect(validator).to receive(:invoke).with(instance_of(PDK::Report), {}).and_return(0)

validators.reject { |r| r == validator }.each do |v|
Expand All @@ -63,6 +65,7 @@
end

it 'invokes each given validator and exits zero' do
allow(PDK::Util).to receive(:module_root).and_return('.')
invoked_validators.each do |validator|
expect(validator).to receive(:invoke).with(instance_of(PDK::Report), {}).and_return(0)
end
Expand All @@ -83,6 +86,7 @@
let(:validator) { PDK::Validate::PuppetValidator }

it 'warns about unknown validators, invokes known validators, and exits zero' do
allow(PDK::Util).to receive(:module_root).and_return('.')
expect(logger).to receive(:warn).with("Unknown validator 'bad-val'. Available validators: #{validator_names}")
expect(validator).to receive(:invoke).with(instance_of(PDK::Report), {}).and_return(0)

Expand All @@ -98,6 +102,7 @@
let(:validator) { PDK::Validate::Metadata }

it 'invokes the specified validator with the target as an option' do
allow(PDK::Util).to receive(:module_root).and_return('.')
expect(validator).to receive(:invoke).with(instance_of(PDK::Report), targets: ['lib/', 'manifests/']).and_return(0)

expect {
Expand Down

0 comments on commit fe10bf8

Please sign in to comment.