diff --git a/.travis.yml b/.travis.yml index ca2a69dc..25b9476e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ script: - cat Gemfile.lock - bundle list - echo travis_fold:end:DEBUG - - COVERAGE=yes bundle exec rake $CHECK + - bundle exec rake $CHECK cache: bundler branches: except: @@ -14,13 +14,14 @@ branches: matrix: include: - rvm: 2.4.3 - env: PUPPET_GEM_VERSION='~> 5' # 5.5 - - env: RVM="jruby-1.7.26" PUPPET_GEM_VERSION='~> 5' JRUBY_OPTS="--debug" + env: PUPPET_GEM_VERSION='~> 5' COVERAGE=yes # 5.5 + - env: RVM="jruby-1.7.26" PUPPET_GEM_VERSION='~> 5' JRUBY_OPTS="--debug" COVERAGE=yes before_cache: pushd ~/.rvm && rm -rf archives rubies/ruby-2.2.7 rubies/ruby-2.3.4 && popd cache: bundler: true directories: ~/.rvm before_install: rvm use jruby-1.7.26 --install --binary --fuzzy + # disable coverage on jruby9k as this confuses codecov - env: RVM="jruby-9.1.9.0" PUPPET_GEM_VERSION='~> 5' JRUBY_OPTS="--debug" before_cache: pushd ~/.rvm && rm -rf archives rubies/ruby-2.2.7 rubies/ruby-2.3.4 && popd cache: @@ -44,7 +45,7 @@ matrix: - rvm: 2.4.1 env: PUPPET_GEM_VERSION='~> 5.0.0' - rvm: 2.1.9 - env: PUPPET_GEM_VERSION='~> 4' # 4.10 + env: PUPPET_GEM_VERSION='~> 4' COVERAGE=yes # 4.10 - rvm: 2.1.9 env: PUPPET_GEM_VERSION='~> 4.9.0' - rvm: 2.1.9 diff --git a/spec/acceptance/device_spec.rb b/spec/acceptance/device_spec.rb index d821feb5..2f5dd0a8 100644 --- a/spec/acceptance/device_spec.rb +++ b/spec/acceptance/device_spec.rb @@ -62,6 +62,7 @@ end end end + describe 'using `puppet device`' do let(:common_args) { super() + ' --target the_node' } let(:device_conf) { Tempfile.new('device.conf') } diff --git a/spec/acceptance/validation_spec.rb b/spec/acceptance/validation_spec.rb index 27bafd04..4e3416eb 100644 --- a/spec/acceptance/validation_spec.rb +++ b/spec/acceptance/validation_spec.rb @@ -60,6 +60,7 @@ expect(status.exitstatus).to eq 1 end end + context 'with a resource which should be absent' do it 'throws' do output, status = Open3.capture2e("puppet resource #{common_args} test_validation foo ensure=absent prop_ro=3") @@ -123,6 +124,7 @@ expect(status.exitstatus).to eq 1 end end + context 'with a resource which should be absent' do it 'throws' do output, status = Open3.capture2e("puppet apply #{common_args} -e \"test_validation{ foo: ensure => absent, param => 3, prop_ro =>4 }\"") diff --git a/spec/classes/autorequire_cycle_spec.rb b/spec/classes/autorequire_cycle_spec.rb index c5527fbb..251acab7 100644 --- a/spec/classes/autorequire_cycle_spec.rb +++ b/spec/classes/autorequire_cycle_spec.rb @@ -6,6 +6,7 @@ it { is_expected.to compile } end + context 'with make_cycle => true' do let(:params) { { make_cycle: true } } diff --git a/spec/puppet/resource_api/base_context_spec.rb b/spec/puppet/resource_api/base_context_spec.rb index 8c2b9ddf..dc38b201 100644 --- a/spec/puppet/resource_api/base_context_spec.rb +++ b/spec/puppet/resource_api/base_context_spec.rb @@ -35,6 +35,7 @@ def send_log(log, msg) before(:each) do allow(Puppet::Util::NetworkDevice).to receive(:current).and_return(nil) end + it 'raises an error' do expect { context.device }.to raise_error RuntimeError, %r{no device configured} end @@ -74,6 +75,7 @@ def send_log(log, msg) expect(context.last_message).to eq 'some_resource[a, b]: message' end end + describe '#warning(msg1, msg2, msg3, ...)' do it 'outputs all passed messages' do context.warning('msg1', 'msg2', 'msg3') diff --git a/spec/puppet/resource_api/type_definition_spec.rb b/spec/puppet/resource_api/type_definition_spec.rb index 74513cb7..592f02ea 100644 --- a/spec/puppet/resource_api/type_definition_spec.rb +++ b/spec/puppet/resource_api/type_definition_spec.rb @@ -36,6 +36,7 @@ it { expect(type).to be_ensurable } it { expect(type.attributes).to be_key(:ensure) } end + context 'when type is not ensurable' do let(:definition) { { attributes: { string: 'something' } } } @@ -73,6 +74,7 @@ expect(type.check_schema_keys(definition[:attributes])).to eq([]) end end + context 'when resource contains invalid keys' do let(:resource) { { name: 'test_string', wibble: '1', foo: '2' } } @@ -90,6 +92,7 @@ expect(type.check_schema_values(resource)).to eq({}) end end + context 'when resource contains invalid values' do let(:resource) { { name: 'test_string', prop: 'foo', ensure: 1 } } diff --git a/spec/puppet/resource_api_spec.rb b/spec/puppet/resource_api_spec.rb index e45cfca8..6e4a220f 100644 --- a/spec/puppet/resource_api_spec.rb +++ b/spec/puppet/resource_api_spec.rb @@ -224,16 +224,19 @@ def extract_values(function) it('the test_boolean value is set correctly') { expect(instance[:test_boolean]).to eq :true } end + context 'when using false' do let(:the_boolean) { false } it('the test_boolean value is set correctly') { expect(instance[:test_boolean]).to eq :false } end + context 'when using an unparsable value' do let(:the_boolean) { 'flubb' } it('an error is raised') { expect { instance }.to raise_error Puppet::ResourceError, %r{test_boolean expect.* Boolean .* got String} } end + context 'when using a legacy symbol' do let(:the_boolean) { :true } @@ -477,6 +480,7 @@ def set(_context, _changes); end end end end + context 'when ensurable is not correctly declared' do let(:definition) do { @@ -1181,6 +1185,7 @@ def set(_context, changes) resources end end + it 'stills raise an error' do expect { instance.strict_check({}) @@ -1736,6 +1741,7 @@ def set(_context, changes) end before(:each) do @value, @error = described_class.try_mungify(type, input, 'error prefix') end + [ { type: 'Boolean', diff --git a/spec/puppet/util/network_device/simple/device_spec.rb b/spec/puppet/util/network_device/simple/device_spec.rb index 6cc27aab..4c00a2f0 100644 --- a/spec/puppet/util/network_device/simple/device_spec.rb +++ b/spec/puppet/util/network_device/simple/device_spec.rb @@ -13,6 +13,7 @@ tempfile.write('{ foo: bar }') tempfile.close end + after(:each) { tempfile.unlink } it 'provides an empty facts set' do