Sha256: 028fadd7819c0dfdd4861f08035c84081d7d39526aad14fd1a3ee4fd73f8b92c

Contents?: true

Size: 992 Bytes

Versions: 4

Compression:

Stored size: 992 Bytes

Contents

describe LinuxAdmin::Common do
  subject { Class.new { include LinuxAdmin::Common }.new }

  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

  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

  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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
linux_admin-0.14.0 spec/common_spec.rb
linux_admin-0.13.0 spec/common_spec.rb
linux_admin-0.12.1 spec/common_spec.rb
linux_admin-0.12.0 spec/common_spec.rb