Sha256: 81449839d81d2302fea0ffd76b11abf47a760f40dac1aa9b141ec3117674e535

Contents?: true

Size: 1.03 KB

Versions: 51

Compression:

Stored size: 1.03 KB

Contents

# Copyright (c) 2012 National ICT Australia Limited (NICTA).
# This software may be used and distributed solely under the terms of the MIT license (License).
# You should find a copy of the License in LICENSE.TXT or at http://opensource.org/licenses/MIT.
# By downloading or using this software you accept the terms and the liability disclaimer in the License.

require 'test_helper'
require 'omf_common/command'

describe OmfCommon::Command do
  describe "when use util file to execute a system command" do
    it "must not print anything to stdout if executed successfully" do
      OmfCommon::Command.execute("ruby -e 'puts 100'").must_match /100/
    end

    it "must capture and log errors if command not found" do
      OmfCommon::Command.execute("blahblah -z").must_be_nil
    end

    it "must log error when exit status is not 0" do
      OmfCommon::Command.execute("ruby -e 'exit 1'").must_be_nil
      OmfCommon::Command.execute("ruby -e 'exit 2'").must_be_nil
      OmfCommon::Command.execute("ruby -e 'exit 3'").must_be_nil
    end
  end
end

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
omf_common-6.2.3 test/omf_common/command_spec.rb
omf_common-6.2.2 test/omf_common/command_spec.rb
omf_common-6.2.1 test/omf_common/command_spec.rb
omf_common-6.2.0 test/omf_common/command_spec.rb
omf_common-6.2.0.pre.2 test/omf_common/command_spec.rb
omf_common-6.2.0.pre.1 test/omf_common/command_spec.rb
omf_common-6.1.14.pre.2 test/omf_common/command_spec.rb
omf_common-6.1.14.pre.1 test/omf_common/command_spec.rb
omf_common-6.1.12 test/omf_common/command_spec.rb
omf_common-6.1.11 test/omf_common/command_spec.rb
omf_common-6.1.10 test/omf_common/command_spec.rb
omf_common-6.1.9 test/omf_common/command_spec.rb
omf_common-6.1.9.pre.4 test/omf_common/command_spec.rb
omf_common-6.1.9.pre.3 test/omf_common/command_spec.rb
omf_common-6.1.9.pre.2 test/omf_common/command_spec.rb
omf_common-6.1.8 test/omf_common/command_spec.rb
omf_common-6.1.7 test/omf_common/command_spec.rb
omf_common-6.1.6 test/omf_common/command_spec.rb
omf_common-6.1.6.pre.2 test/omf_common/command_spec.rb
omf_common-6.1.6.pre.1 test/omf_common/command_spec.rb