Sha256: 54c9379a81b8d797faaf4b84825d2cc449355689634749b39cdbeba706d03e5e

Contents?: true

Size: 1.03 KB

Versions: 10

Compression:

Stored size: 1.03 KB

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

  [described_class, LinuxAdmin].each do |klass|
    describe "#{klass}.run" do
      it "runs a command with AwesomeSpawn.run" do
        expect(AwesomeSpawn).to receive(:run).with("echo", nil => "test")
        klass.run("echo", nil => "test")
      end
    end

    describe "#{klass}.run!" do
      it "runs a command with AwesomeSpawn.run!" do
        expect(AwesomeSpawn).to receive(:run!).with("echo", nil => "test")
        klass.run!("echo", nil => "test")
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
linux_admin-1.2.4 spec/common_spec.rb
linux_admin-1.2.3 spec/common_spec.rb
linux_admin-1.2.2 spec/common_spec.rb
linux_admin-1.2.1 spec/common_spec.rb
linux_admin-1.0.1 spec/common_spec.rb
linux_admin-1.2.0 spec/common_spec.rb
linux_admin-1.1.0 spec/common_spec.rb
linux_admin-1.0.0 spec/common_spec.rb
linux_admin-0.20.2 spec/common_spec.rb
linux_admin-0.20.1 spec/common_spec.rb