Skip to content

Commit

Permalink
Rubocopification
Browse files Browse the repository at this point in the history
  • Loading branch information
Will Meek committed Nov 15, 2017
1 parent 6027e05 commit 438a48a
Show file tree
Hide file tree
Showing 21 changed files with 877 additions and 1,053 deletions.
110 changes: 0 additions & 110 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,110 +0,0 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2017-09-26 11:49:52 +0100 using RuboCop version 0.49.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 7
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: auto_detection, squiggly, active_support, powerpack, unindent
Layout/IndentHeredoc:
Exclude:
- 'spec/acceptance/apt_key_provider_spec.rb'
- 'spec/unit/facter/apt_has_updates_spec.rb'
- 'spec/unit/facter/apt_package_security_updates_spec.rb'
- 'spec/unit/facter/apt_package_updates_spec.rb'
- 'spec/unit/facter/apt_security_updates_spec.rb'
- 'spec/unit/facter/apt_updates_spec.rb'

# Offense count: 1
Lint/HandleExceptions:
Exclude:
- 'spec/spec_helper.rb'

# Offense count: 8
Lint/ParenthesesAsGroupedExpression:
Exclude:
- 'spec/classes/apt_backports_spec.rb'
- 'spec/classes/apt_update_spec.rb'

# Offense count: 1
Lint/RescueException:
Exclude:
- 'spec/spec_helper_acceptance.rb'

# Offense count: 1
Lint/ScriptPermission:
Exclude:
- 'spec/classes/apt_update_spec.rb'

# Offense count: 1
Lint/UselessAssignment:
Exclude:
- 'spec/spec_helper_acceptance.rb'

# Offense count: 1
# Configuration parameters: CustomIncludeMethods.
RSpec/EmptyExampleGroup:
Exclude:
- 'spec/defines/ppa_spec.rb'

# Offense count: 51
# Configuration parameters: Max.
RSpec/ExampleLength:
Exclude:
- 'spec/acceptance/apt_key_provider_spec.rb'
- 'spec/acceptance/apt_spec.rb'
- 'spec/classes/apt_spec.rb'
- 'spec/defines/key_compat_spec.rb'
- 'spec/defines/key_spec.rb'
- 'spec/unit/puppet/type/apt_key_spec.rb'

# Offense count: 4
RSpec/MultipleExpectations:
Max: 2

# Offense count: 61
RSpec/NamedSubject:
Exclude:
- 'spec/classes/apt_backports_spec.rb'
- 'spec/classes/apt_spec.rb'
- 'spec/defines/conf_spec.rb'
- 'spec/defines/key_compat_spec.rb'
- 'spec/defines/key_spec.rb'
- 'spec/defines/pin_spec.rb'
- 'spec/defines/ppa_spec.rb'
- 'spec/defines/setting_spec.rb'
- 'spec/defines/source_compat_spec.rb'
- 'spec/defines/source_spec.rb'

# Offense count: 4
# Configuration parameters: Max.
RSpec/NestedGroups:
Exclude:
- 'spec/defines/key_compat_spec.rb'
- 'spec/defines/key_spec.rb'

# Offense count: 3
RSpec/ScatteredLet:
Exclude:
- 'spec/defines/key_compat_spec.rb'
- 'spec/defines/key_spec.rb'

# Offense count: 1
# Configuration parameters: MinBodyLength.
Style/GuardClause:
Exclude:
- 'spec/spec_helper_acceptance.rb'

# Offense count: 15
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes.
# SupportedStyles: slashes, percent_r, mixed
Style/RegexpLiteral:
Exclude:
- 'spec/classes/apt_spec.rb'
- 'spec/defines/source_compat_spec.rb'
- 'spec/defines/source_spec.rb'
1,143 changes: 567 additions & 576 deletions spec/acceptance/apt_key_provider_spec.rb

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions spec/acceptance/apt_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,7 @@
TIMEOUT_RETRY_WAIT = 5
TIMEOUT_ERROR_MATCHER = %r{no valid OpenPGP data found}

describe 'apt class' do
context 'reset' do
it 'fixes the sources.list' do
shell('cp /etc/apt/sources.list /tmp')
end
end

context 'all the things' do
it 'works with no errors' do
pp = <<-EOS
everything_everything_pp = <<-EOS
if $::lsbdistcodename == 'lucid' {
$sources = undef
} else {
Expand Down Expand Up @@ -43,14 +34,23 @@ class { 'apt':
},
sources => $sources,
}
EOS
EOS

describe 'apt class' do
context 'reset' do
it 'fixes the sources.list' do
shell('cp /etc/apt/sources.list /tmp')
end
end

context 'all the things' do
it 'works with no errors' do
# Apply the manifest (Retry if timeout error is received from key pool)
retry_on_error_matching(MAX_TIMEOUT_RETRY, TIMEOUT_RETRY_WAIT, TIMEOUT_ERROR_MATCHER) do
apply_manifest(pp, catch_failures: true)
apply_manifest(everything_everything_pp, catch_failures: true)
end

apply_manifest(pp, catch_failures: true)
apply_manifest(everything_everything_pp, catch_failures: true)
end
it 'stills work' do
shell('apt-get update')
Expand Down
38 changes: 10 additions & 28 deletions spec/classes/apt_backports_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'apt::backports', type: :class do
let (:pre_condition) { "class{ '::apt': }" }
let(:pre_condition) { "class{ '::apt': }" }

describe 'debian/ubuntu tests' do
context 'defaults on deb' do
Expand Down Expand Up @@ -139,9 +139,7 @@
end

it do
expect {
subject.call
}.to raise_error(Puppet::Error, %r{If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key})
is_expected.to raise_error(Puppet::Error, %r{If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key})
end
end
context 'missing release' do
Expand All @@ -154,9 +152,7 @@
end

it do
expect {
subject.call
}.to raise_error(Puppet::Error, %r{If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key})
is_expected.to raise_error(Puppet::Error, %r{If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key})
end
end
context 'missing repos' do
Expand All @@ -169,9 +165,7 @@
end

it do
expect {
subject.call
}.to raise_error(Puppet::Error, %r{If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key})
is_expected.to raise_error(Puppet::Error, %r{If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key})
end
end
context 'missing key' do
Expand All @@ -184,9 +178,7 @@
end

it do
expect {
subject.call
}.to raise_error(Puppet::Error, %r{If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key})
is_expected.to raise_error(Puppet::Error, %r{If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key})
end
end
end
Expand All @@ -210,9 +202,7 @@
end

it do
expect {
subject.call
}.to raise_error(Puppet::Error, %r{expects a})
is_expected.to raise_error(Puppet::Error, %r{expects a})
end
end
context 'invalid release' do
Expand All @@ -223,9 +213,7 @@
end

it do
expect {
subject.call
}.to raise_error(Puppet::Error, %r{expects a})
is_expected.to raise_error(Puppet::Error, %r{expects a})
end
end
context 'invalid repos' do
Expand All @@ -236,9 +224,7 @@
end

it do
expect {
subject.call
}.to raise_error(Puppet::Error, %r{expects a})
is_expected.to raise_error(Puppet::Error, %r{expects a})
end
end
context 'invalid key' do
Expand All @@ -249,9 +235,7 @@
end

it do
expect {
subject.call
}.to raise_error(Puppet::Error, %r{expects a})
is_expected.to raise_error(Puppet::Error, %r{expects a})
end
end
context 'invalid pin' do
Expand All @@ -262,9 +246,7 @@
end

it do
expect {
subject.call
}.to raise_error(Puppet::Error, %r{expects a})
is_expected.to raise_error(Puppet::Error, %r{expects a})
end
end
end
Expand Down
Loading

0 comments on commit 438a48a

Please sign in to comment.