Sha256: fd2d8ca69dfbe2d35fc2ce2ecd5582518433b5148b42b117c19ff4fc1236f792

Contents?: true

Size: 620 Bytes

Versions: 2

Compression:

Stored size: 620 Bytes

Contents

require 'stub_shell/result'
require 'stub_shell/command'
require 'stub_shell/shell'
require 'stub_shell/test_helpers'

module StubShell  
  class << self
    attr_accessor :current_context
    
    def run_command cmd
      command, StubShell.current_context = StubShell.current_context.execute(cmd)
      Kernel.send(:`, "#{File.join(File.dirname(__FILE__), '..', 'bin', 'fake_process.sh')} '#{command.result.exitstatus}'")
      command
    end
  end
  
  self.current_context = nil
end

def `(cmd)
  StubShell.run_command(cmd).result.stdout
end

def system(cmd)
  StubShell.run_command(cmd).result.exitstatus == 0
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stub_shell-0.0.3 lib/stub_shell.rb
stub_shell-0.0.2 lib/stub_shell.rb