Class: Furnish::SchedulerTestCase

Inherits:
TestCase
  • Object
show all
Defined in:
lib/furnish/test.rb

Overview

SchedulerTestCase inherits from Furnish::TestCase and configures a threaded scheduler, but does not attempt to start it. It’s intended to be a primitive for cases where you might create a number of schedulers.

If the scheduler throws an exception for any reason, the test suite will abort.

RunningSchedulerTestCase deals with managing a running scheduler for you.

Direct Known Subclasses

RunningSchedulerTestCase

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#schedObject (readonly)

Furnish::Scheduler object.



62
63
64
# File 'lib/furnish/test.rb', line 62

def sched
  @sched
end

Instance Method Details

#assert_solved(name) ⇒ Object

Assert the named group is solved, as far as the scheduler’s concerned.



80
81
82
# File 'lib/furnish/test.rb', line 80

def assert_solved(name)
  assert_includes(sched.vm.solved, name, "#{name} is solved in the scheduler")
end

#refute_solved(name) ⇒ Object

Refute the named group is solved, as far as the scheduler’s concerned.



88
89
90
# File 'lib/furnish/test.rb', line 88

def refute_solved(name)
  refute_includes(sched.vm.solved, name, "#{name} is solved in the scheduler")
end

#setupObject

:nodoc:



64
65
66
67
68
69
# File 'lib/furnish/test.rb', line 64

def setup # :nodoc:
  super
  @sched = Furnish::Scheduler.new
  @monitor = Thread.new { loop { @sched.running?; sleep 1 } }
  @monitor.abort_on_exception = true
end

#teardownObject

:nodoc:



71
72
73
74
# File 'lib/furnish/test.rb', line 71

def teardown # :nodoc:
  @monitor.kill rescue nil
  super
end