Skip to content

Commit

Permalink
Merge pull request #98 from DavidS/rubocop-fixes
Browse files Browse the repository at this point in the history
Whitespace cleanup with new rubocop version
  • Loading branch information
da-ar authored Jun 18, 2018
2 parents 838b76f + 68b352a commit 3a5790a
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 4 deletions.
9 changes: 5 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,22 @@ 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:
- release-prep
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:
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions spec/acceptance/device_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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') }
Expand Down
2 changes: 2 additions & 0 deletions spec/acceptance/validation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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 }\"")
Expand Down
1 change: 1 addition & 0 deletions spec/classes/autorequire_cycle_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

it { is_expected.to compile }
end

context 'with make_cycle => true' do
let(:params) { { make_cycle: true } }

Expand Down
2 changes: 2 additions & 0 deletions spec/puppet/resource_api/base_context_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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')
Expand Down
3 changes: 3 additions & 0 deletions spec/puppet/resource_api/type_definition_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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' } } }

Expand Down Expand Up @@ -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' } }

Expand All @@ -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 } }

Expand Down
6 changes: 6 additions & 0 deletions spec/puppet/resource_api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

Expand Down Expand Up @@ -477,6 +480,7 @@ def set(_context, _changes); end
end
end
end

context 'when ensurable is not correctly declared' do
let(:definition) do
{
Expand Down Expand Up @@ -1181,6 +1185,7 @@ def set(_context, changes)
resources
end
end

it 'stills raise an error' do
expect {
instance.strict_check({})
Expand Down Expand Up @@ -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',
Expand Down
1 change: 1 addition & 0 deletions spec/puppet/util/network_device/simple/device_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
tempfile.write('{ foo: bar }')
tempfile.close
end

after(:each) { tempfile.unlink }

it 'provides an empty facts set' do
Expand Down

0 comments on commit 3a5790a

Please sign in to comment.