class SpecInfra::Backend::RSpecSystem

Public Instance Methods

run_command(cmd, opt={}) click to toggle source
# File lib/rspec-system-serverspec/backend/rspec_system.rb, line 6
def run_command(cmd, opt={})
  cmd = build_command(cmd)
  cmd = add_pre_command(cmd)
  ret = ssh_exec!(cmd)

  if @example
    @example.metadata[:command] = cmd
    @example.metadata[:stdout]  = ret[:stdout]
  end

  ret
end

Private Instance Methods

ssh_exec!(command) click to toggle source
# File lib/rspec-system-serverspec/backend/rspec_system.rb, line 20
def ssh_exec!(command)
  ::RSpecSystem::Helpers.shell(command).to_hash.inject({}) do |h,(k,v)|
    k = :exit_status if k == :exit_code
  h[k] = v
  h
  end
end