spec/puppet-check/cli_spec.rb in puppet-check-1.3.2 vs spec/puppet-check/cli_spec.rb in puppet-check-1.4.0
- old
+ new
@@ -2,30 +2,42 @@
require_relative '../../lib/puppet-check/cli'
describe PuppetCheck::CLI do
context '.run' do
it 'raises an error if no paths were specified' do
- expect { PuppetCheck::CLI.run(%w(-s -f)) }.to raise_error(RuntimeError, 'puppet-check: no paths specified')
+ expect { PuppetCheck::CLI.run(%w(-s -f)) }.to raise_error(RuntimeError, 'puppet-check: no paths specified; try using --help')
end
end
context '.parse' do
it 'raises an error if an invalid option was specified' do
expect { PuppetCheck::CLI.parse(%w(-s -f -asdf foo)) }.to raise_error(OptionParser::InvalidOption)
end
- it 'allows future parser and style check to be enabled' do
+ it 'allows future parser, style, smoke, and regression checks to be enabled' do
PuppetCheck.future_parser = false
PuppetCheck.style_check = false
- PuppetCheck::CLI.parse(%w(-s -f foo))
+ PuppetCheck.smoke_check = false
+ PuppetCheck.regression_check = false
+ PuppetCheck::CLI.parse(%w(-s -f -r --smoke foo))
expect(PuppetCheck.future_parser).to eql(true)
expect(PuppetCheck.style_check).to eql(true)
+ expect(PuppetCheck.smoke_check).to eql(true)
+ expect(PuppetCheck.regression_check).to eql(true)
end
it 'correctly parses a formatting option' do
PuppetCheck.output_format = ''
PuppetCheck::CLI.parse(%w(-o text))
expect(PuppetCheck.output_format).to eql('text')
+ end
+
+ it 'correctly parses octocatalog-diff options' do
+ PuppetCheck.octoconfig = ''
+ PuppetCheck.octonodes = []
+ PuppetCheck::CLI.parse(%w(--octoconfig config.cfg.rb --octonodes server1,server2))
+ expect(PuppetCheck.octoconfig).to eql('config.cfg.rb')
+ expect(PuppetCheck.octonodes).to eql(%w(server1 server2))
end
it 'correctly parses PuppetLint arguments' do
PuppetCheck.puppetlint_args = []
PuppetCheck::CLI.parse(%w(--puppet-lint puppetlint-arg-one,puppetlint-arg-two foo))