Sha256: 3361951aaa21a253a82c264ef629404154cc811ed941f1353718b0189ed0111b

Contents?: true

Size: 1012 Bytes

Versions: 5

Compression:

Stored size: 1012 Bytes

Contents

require 'spec_helper'

describe LitmusPaper::Dependency::Script do
  describe "#available?" do
    it "is true when the script returns 0" do
      check = LitmusPaper::Dependency::Script.new("true")
      check.should be_available
    end

    it "is false when the script returns 1" do
      check = LitmusPaper::Dependency::Script.new("false")
      check.should_not be_available
    end

    it "is false when the script exceeds the timeout" do
      check = LitmusPaper::Dependency::Script.new("sleep 10", :timeout => 1)
      check.should_not be_available
    end

    it "can handle pipes" do
      check = LitmusPaper::Dependency::Script.new("ls | grep lib")
      check.should be_available

      check = LitmusPaper::Dependency::Script.new("ls | grep missing")
      check.should_not be_available
    end
  end

  describe "to_s" do
    it "returns the command" do
      check = LitmusPaper::Dependency::Script.new("sleep 10")
      check.to_s.should == "Dependency::Script(sleep 10)"
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
litmus_paper-0.7.5 spec/litmus_paper/dependency/script_spec.rb
litmus_paper-0.7.4 spec/litmus_paper/dependency/script_spec.rb
litmus_paper-0.7.3 spec/litmus_paper/dependency/script_spec.rb
litmus_paper-0.7.2 spec/litmus_paper/dependency/script_spec.rb
litmus_paper-0.7.1 spec/litmus_paper/dependency/script_spec.rb