Skip to content

Commit

Permalink
fix(rubocop): add fixes using rubocop -a --safe
Browse files Browse the repository at this point in the history
  • Loading branch information
myii committed Jan 16, 2020
1 parent 08340c8 commit 1f72c40
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 20 deletions.
6 changes: 4 additions & 2 deletions test/integration/default/controls/archives_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

### ARCHIVE PKGS
control 'Archive packages' do
title 'should be downloaded and installed'
Expand All @@ -7,10 +9,10 @@
os.debian?
end

%w(
%w[
docker-compose.yml
phantomjs-2.1.1-linux-x86_64/bin
).each do |f|
].each do |f|
describe file("/usr/local/src/#{f}") do
it { should exist }
end
Expand Down
10 changes: 6 additions & 4 deletions test/integration/default/controls/gems_spec.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# frozen_string_literal: true

### WANTED/REQUIRED
control 'Wanted/Required gems' do
title 'should be installed'

%w{
%w[
progressbar
minitest
}.each do |p|
].each do |p|
describe gem(p) do
it { should be_installed }
end
Expand All @@ -15,11 +17,11 @@
### UNWANTED
control 'Unwanted gems' do
title 'should be uninstalled'
%w{
%w[
diff-lcs
kwalify
kitchen-vagrant
}.each do |p|
].each do |p|
describe gem(p) do
it { should_not be_installed }
end
Expand Down
30 changes: 16 additions & 14 deletions test/integration/default/controls/pkgs_spec.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# frozen_string_literal: true

## Some vars
common_packages = %w(
common_packages = %w[
git
less
bc
curl
fail2ban
)
]

case platform[:family]
when 'redhat'
platform_packages = %w(yum-plugin-versionlock)
platform_packages = %w[yum-plugin-versionlock]
held_packages = {
# We use this test for held packages in a list,
# with no version (current version).
Expand All @@ -32,16 +34,16 @@
# Adding empty Suse entries, to get tests passing
# Don't know the correct values to add here.
when 'suse'
platform_packages = %w()
platform_packages = %w[]
held_packages = {}
lock_file = ''
# Adding empty Arch entries, to get tests passing
when 'arch'
platform_packages = %w()
platform_packages = %w[]
held_packages = {}
lock_file = ''
when 'debian'
platform_packages = %w()
platform_packages = %w[]
held_packages = {
'alien': '8.95',
# To match also ubuntu16's
Expand All @@ -54,11 +56,11 @@
held_packages = []
end

## FIXME - not testing Held packages
# # FIXME - not testing Held packages
held_packages = {}

unheld_packages = (common_packages + platform_packages).flatten.uniq
all_packages = (unheld_packages + held_packages.keys.map { |k| k.to_s }).flatten.uniq
all_packages = (unheld_packages + held_packages.keys.map(&:to_s)).flatten.uniq

### WANTED/REQUIRED/HELD
control 'Wanted/Required/Held packages' do
Expand All @@ -75,7 +77,7 @@
control 'Wanted packages' do
title 'should NOT be marked as hold'

unheld_packages.each do |p,v|
unheld_packages.each do |p, v|
case platform[:family]
when 'redhat', 'fedora'
match_string = "#{p}-.*#{v}"
Expand All @@ -95,26 +97,26 @@
control 'Held packages' do
title 'should be marked as hold'

held_packages.each do |p,v|
held_packages.each do |p, v|
case platform[:family]
when 'redhat', 'fedora'
match_string = "#{p}-.*#{v}"
when 'debian'
match_string = "^Package: #{p}\nStatus: hold ok installed\nP.*\nS.*\nI.*\nM.*\nA.*\nVersion: #{v}"
end

describe file(lock_file) do
its('content') { should match(match_string) }
end
end
end

### UNWANTED
control 'Unwanted packages' do
title 'should be uninstalled'
%w{
%w[
avahi-daemon
}.each do |p|
].each do |p|
describe package(p) do
it { should_not be_installed }
end
Expand Down
2 changes: 2 additions & 0 deletions test/integration/default/controls/remote_pkgs_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

### REMOTE PKGS
remote_pkgs = ['zoom']

Expand Down

0 comments on commit 1f72c40

Please sign in to comment.