Class: Procrastinator::Test::MockThread

Inherits:
Object
  • Object
show all
Defined in:
lib/procrastinator/test/mocks.rb

Overview

Testing mock Thread class

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name: nil, status: nil) ⇒ MockThread

Returns a new instance of MockThread.



56
57
58
59
# File 'lib/procrastinator/test/mocks.rb', line 56

def initialize(name: nil, status: nil)
   @name   = name
   @status = status
end

Instance Attribute Details

#statusObject (readonly)

Returns the value of attribute status.



54
55
56
# File 'lib/procrastinator/test/mocks.rb', line 54

def status
  @status
end

Instance Method Details

#alive?Boolean

Returns:

  • (Boolean)


67
68
69
# File 'lib/procrastinator/test/mocks.rb', line 67

def alive?
   true
end

#join(_timeout) ⇒ Object



61
62
# File 'lib/procrastinator/test/mocks.rb', line 61

def join(_timeout)
end

#killObject



64
65
# File 'lib/procrastinator/test/mocks.rb', line 64

def kill
end

#thread_variable_get(var_name) ⇒ Object



71
72
73
74
75
76
77
78
# File 'lib/procrastinator/test/mocks.rb', line 71

def thread_variable_get(var_name)
   case var_name
   when :name
      @name
   else
      raise 'test error: undefined thread var'
   end
end