Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/linux_admin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
require 'active_support/core_ext'

require 'linux_admin/common'
require 'linux_admin/exceptions'
require 'linux_admin/rhn'
require 'linux_admin/rpm'
require 'linux_admin/subscription_manager'
Expand Down
2 changes: 0 additions & 2 deletions lib/linux_admin/common.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
require 'shellwords'

class LinuxAdmin
class CommandError < RuntimeError; end

module Common
def cmd(cmd)
Distro.local.class::COMMANDS[cmd]
Expand Down
1 change: 1 addition & 0 deletions lib/linux_admin/exceptions.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
class CommandError < RuntimeError; end
2 changes: 1 addition & 1 deletion lib/linux_admin/yum.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def self.update(*packages)
end

def self.version_available(*packages)
raise ArgumentError, "packages requires at least one package name" unless packages
raise ArgumentError, "packages requires at least one package name" if packages.blank?

cmd = "repoquery --qf=\"%{name} %{version}\""
params = {nil => packages}
Expand Down
8 changes: 4 additions & 4 deletions spec/common_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ class TestClass
end

it "command ok exit bad" do
expect { subject.run("false") }.to raise_error
expect { subject.run("false") }.to raise_error(CommandError)
end

it "command bad" do
expect { subject.run("XXXXX") }.to raise_error
expect { subject.run("XXXXX") }.to raise_error(Errno::ENOENT)
end

context "with :return_exitstatus => true" do
Expand All @@ -97,11 +97,11 @@ class TestClass
end

it "command ok exit bad" do
expect { subject.run("false", :return_output => true) }.to raise_error
expect { subject.run("false", :return_output => true) }.to raise_error(CommandError)
end

it "command bad" do
expect { subject.run("XXXXX", :return_output => true) }.to raise_error
expect { subject.run("XXXXX", :return_output => true) }.to raise_error(Errno::ENOENT)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/yum_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@

context ".version_available" do
it "no packages" do
expect { described_class.version_available }.to raise_error
expect { described_class.version_available }.to raise_error(ArgumentError)
end

it "with packages" do
Expand Down