alpine resource: Fix small style issues (#3238)

* Constrain RuboCop disables to single method
* Add comment to Alpine package command
* Use single quotes for Alpine package command
* Change `it` statement to be readable

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
This commit is contained in:
Jerry Aldrich 2018-07-25 12:57:51 -07:00 committed by Jared Quick
parent c647ac9469
commit c1d7b2cfa3
3 changed files with 4 additions and 9 deletions

View file

@ -19,10 +19,7 @@ module Inspec::Resources
its('version') { should eq 1.9.5 }
end
"
# rubocop:disable Metrics/AbcSize
# rubocop:disable Metrics/CyclomaticComplexity
# rubocop:disable Metrics/PerceivedComplexity
def initialize(package_name, opts = {})
def initialize(package_name, opts = {}) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
@package_name = package_name
@name = @package_name
@cache = nil
@ -54,9 +51,6 @@ module Inspec::Resources
evaluate_missing_requirements
end
# rubocop:enable Metrics/AbcSize
# rubocop:enable Metrics/CyclomaticComplexity
# rubocop:enable Metrics/PerceivedComplexity
# returns true if the package is installed
def installed?(_provider = nil, _version = nil)

View file

@ -523,7 +523,8 @@ class MockLoader
"(New-Object System.Security.Principal.SecurityIdentifier(\"S-1-5-32-544\")).Translate( [System.Security.Principal.NTAccount]).Value" => cmd.call('security-policy-sid-translated'),
"(New-Object System.Security.Principal.SecurityIdentifier(\"S-1-5-32-555\")).Translate( [System.Security.Principal.NTAccount]).Value" => cmd.call('security-policy-sid-untranslated'),
"apk info -vv --no-network | grep git" => cmd.call('apk-info-grep-git'),
# alpine package commands
'apk info -vv --no-network | grep git' => cmd.call('apk-info-grep-git'),
}
@backend
end

View file

@ -153,7 +153,7 @@ describe 'Inspec::Resources::Package' do
end
# alpine
it 'verify Alpine package processing' do
it 'can parse Alpine packages' do
resource = MockLoader.new(:alpine).load_resource('package', 'git')
pkg = { name: 'git', installed: true, version: '2.15.0-r1', type: 'pkg' }
_(resource.installed?).must_equal true