Class: Spex::RestartedCheck

Inherits:
ProcessCheck show all
Defined in:
lib/spex/checks/restarted_check.rb

Instance Attribute Summary

Attributes inherited from Check

#options, #target

Instance Method Summary collapse

Methods inherited from ProcessCheck

#current_pid, #pattern, #ps_executable

Methods inherited from Check

[], #active?, as, each, example, examples, #initialize, option, options, #prepare, registry, #to_s, #validate!

Constructor Details

This class inherits a constructor from Spex::Check

Instance Method Details

#afterObject



12
13
14
15
16
17
18
19
20
# File 'lib/spex/checks/restarted_check.rb', line 12

def after
  after_pid = current_pid
  assert after_pid, "Process '#{target}' is not running"
  if active?
    assert_not_equal @before_pid, after_pid, "Process '#{target}' pid was not changed (still #{@before_pid})"
  else
    assert_equal @before_pid, after_pid, "Process '#{target}' pid was changed (was #{@before_pid}, now #{after_pid})"
  end
end

#beforeObject



7
8
9
10
# File 'lib/spex/checks/restarted_check.rb', line 7

def before
  @before_pid = current_pid
  assert @before_pid, "Process '#{target}' is not running"
end