spec/common_spec.rb in linux_admin-0.11.1 vs spec/common_spec.rb in linux_admin-0.12.0
- old
+ new
@@ -1,19 +1,37 @@
describe LinuxAdmin::Common do
subject { Class.new { include LinuxAdmin::Common }.new }
- context "#cmd" do
+ describe "#cmd" do
it "looks up local command from id" do
expect(subject.cmd(:dd)).to match(/bin\/dd/)
end
+
+ it "returns nil when it can't find the command" do
+ expect(subject.cmd(:kasgbdlcvjhals)).to be_nil
+ end
end
- it "#run" do
- expect(AwesomeSpawn).to receive(:run).with("echo", nil => "test")
- subject.run("echo", nil => "test")
+ describe "#cmd?" do
+ it "returns true when the command exists" do
+ expect(subject.cmd?(:dd)).to be true
+ end
+
+ it "returns false when the command doesn't exist" do
+ expect(subject.cmd?(:kasgbdlcvjhals)).to be false
+ end
end
- it "#run!" do
- expect(AwesomeSpawn).to receive(:run!).with("echo", nil => "test")
- subject.run!("echo", nil => "test")
+ describe "#run" do
+ it "runs a command with AwesomeSpawn.run" do
+ expect(AwesomeSpawn).to receive(:run).with("echo", nil => "test")
+ subject.run("echo", nil => "test")
+ end
+ end
+
+ describe "#run!" do
+ it "runs a command with AwesomeSpawn.run!" do
+ expect(AwesomeSpawn).to receive(:run!).with("echo", nil => "test")
+ subject.run!("echo", nil => "test")
+ end
end
end