Sha256: f6d54c7aa33917f93e8c0641583745708ca8787b7f3fb90d34fc94d2ff162afe

Contents?: true

Size: 981 Bytes

Versions: 6

Compression:

Stored size: 981 Bytes

Contents

describe LinuxAdmin::Common do
  describe "#cmd" do
    it "looks up local command from id" do
      expect(described_class.cmd(:dd)).to match(%r{bin/dd})
    end

    it "returns nil when it can't find the command" do
      expect(described_class.cmd(:kasgbdlcvjhals)).to be_nil
    end
  end

  describe "#cmd?" do
    it "returns true when the command exists" do
      expect(described_class.cmd?(:dd)).to be true
    end

    it "returns false when the command doesn't exist" do
      expect(described_class.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")
      described_class.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")
      described_class.run!("echo", nil => "test")
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
linux_admin-0.20.0 spec/common_spec.rb
linux_admin-0.19.0 spec/common_spec.rb
linux_admin-0.18.0 spec/common_spec.rb
linux_admin-0.17.0 spec/common_spec.rb
linux_admin-0.16.0 spec/common_spec.rb
linux_admin-0.15.0 spec/common_spec.rb