Sha256: b4e66ba8984fedc010c3340831352ec486888efe0bd7de6f40dc70e241f60794

Contents?: true

Size: 989 Bytes

Versions: 10

Compression:

Stored size: 989 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

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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
fedux_org-stdlib-0.1.1 spec/command_spec.rb
fedux_org-stdlib-0.1.0 spec/command_spec.rb
fedux_org-stdlib-0.0.39 spec/command_spec.rb
fedux_org-stdlib-0.0.38 spec/command_spec.rb
fedux_org-stdlib-0.0.37 spec/command_spec.rb
fedux_org-stdlib-0.0.36 spec/command_spec.rb
fedux_org-stdlib-0.0.35 spec/command_spec.rb
fedux_org-stdlib-0.0.33 spec/command_spec.rb
fedux_org-stdlib-0.0.32 spec/command_spec.rb
fedux_org-stdlib-0.0.31 spec/command_spec.rb