Skip to content

Commit

Permalink
Rubocop code style improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
lacostej committed Nov 21, 2019
1 parent 96a8eee commit 4c2bb75
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
8 changes: 3 additions & 5 deletions lib/u3d/commands.rb
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,8 @@ def cache_versions(os, offline: false, force_refresh: false, central_cache: true

def verify_package_names(packages, definition)
unless packages.nil?
invalid_packages = packages.select { |package| !definition.available_package? package }
unless invalid_packages.empty?
raise ArgumentError, "Package(s) '#{invalid_packages.join(',')}' are not known. Use #{definition.available_packages.join(',')}"
end
invalid_packages = packages.reject { |package| definition.available_package? package }
raise ArgumentError, "Package(s) '#{invalid_packages.join(',')}' are not known. Use #{definition.available_packages.join(',')}" unless invalid_packages.empty?
end
packages
end
Expand Down Expand Up @@ -437,4 +435,4 @@ def get_administrative_privileges(options)
end

class InstallationSetupError < StandardError
end
end
6 changes: 3 additions & 3 deletions spec/u3d/commands_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@
with_fake_cache('fakeos' => { 'versions' => { '1.2.3f4' => 'fakeurl' } })
allow(U3d::Helper).to receive(:data_path) { 'whatever' }

definition = expected_definition(
expected_definition(
'1.2.3f4',
:fakeos,
'fakeurl',
Expand All @@ -359,7 +359,7 @@
]
)

expect{
expect do
U3d::Commands.install(
args: ['1.2.3f4'],
options: {
Expand All @@ -368,7 +368,7 @@
packages: ['not.a.package']
}
)
}.to raise_error ArgumentError, /'not.a.package'/
end.to raise_error ArgumentError, /'not.a.package'/
end
# support downloading the not current platform -> not yet supported
# TODO: Implement me
Expand Down

0 comments on commit 4c2bb75

Please sign in to comment.