Class: TestbeatShellVagrant

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/spec_helper.rb

Instance Method Summary collapse

Constructor Details

#initialize(vagrantFolder) ⇒ TestbeatShellVagrant

Returns a new instance of TestbeatShellVagrant.



159
160
161
# File 'lib/rspec/spec_helper.rb', line 159

def initialize(vagrantFolder)
  @vagrantFolder = vagrantFolder
end

Instance Method Details

#exec(cmd) ⇒ Object



163
164
165
166
167
168
169
170
171
172
# File 'lib/rspec/spec_helper.rb', line 163

def exec(cmd)
  $logger.debug {"Exec: #{cmd}"}
  stdout = nil
  Dir.chdir(@vagrantFolder){
    @out = %x[vagrant ssh -c '#{cmd}' 2>&1]
    @status = $?
  }
  $logger.debug {"Exec result #{exitstatus}: #{@out[0,50].strip}"}
  return self
end

#exitstatusObject



179
180
181
# File 'lib/rspec/spec_helper.rb', line 179

def exitstatus
  @status.exitstatus
end

#ok?Boolean

Returns:

  • (Boolean)


183
184
185
# File 'lib/rspec/spec_helper.rb', line 183

def ok?
  exitstatus == 0
end

#outObject

output of latest exec (stdout and stderr merged, as we haven’t worked on separating them)



175
176
177
# File 'lib/rspec/spec_helper.rb', line 175

def out
  @out
end