Sha256: 1336a0ba39dbd43bc0a3855c9772bdf96d42505817489bc64d0ef9cba3328736

Contents?: true

Size: 822 Bytes

Versions: 4

Compression:

Stored size: 822 Bytes

Contents

require 'spec_helper'

describe Command do
  context '#run_command' do
    klass = Class.new do
      include Command
    end

    it 'captures stdout' do
      result = klass.new.run_command( 'echo hello_world' )

      expect( result.stdout.chomp ).to eq( 'hello_world' )
    end

    it 'captures stderr' do
      result = klass.new.run_command( 'echo hello_world >&2' )

      expect( result.stderr.chomp ).to eq( 'hello_world' )
    end

    it 'captures exit status' do
      result = klass.new.run_command( 'echo hello_world >&2' )

      expect( result.status.exitstatus ).to eq( 0 )
    end
  end

  context '#which' do
    klass = Class.new do
      include Command
    end

    it 'returns full path for a valid command' do
      expect( klass.new.which( 'which' ) ).to eq( '/usr/bin/which' )
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fedux_org-stdlib-0.0.30 spec/command_spec.rb
fedux_org-stdlib-0.0.29 spec/command_spec.rb
fedux_org-stdlib-0.0.28 spec/command_spec.rb
fedux_org-stdlib-0.0.26 spec/command_spec.rb