Module: Jade::Tasks
- Extended by:
- Tasks
- Included in:
- Tasks
- Defined in:
- lib/jade/tasks.rb,
lib/jade/tasks/rspec.rb
Defined Under Namespace
Modules: Matcher, Outcome, RSpec
Classes: Block, ReturnedTask, TestRegistry, Unbound
Constant Summary
collapse
- REGISTRATIONS =
{}
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.dispatch(task_def, *args) ⇒ Object
Override production dispatch to route through the per-thread test registry.
57
58
59
|
# File 'lib/jade/tasks/rspec.rb', line 57
def self.dispatch(task_def, *args)
test_registry.dispatch(task_def, args)
end
|
.reset!(strict: false) ⇒ Object
65
66
67
68
69
|
# File 'lib/jade/tasks/rspec.rb', line 65
def self.reset!(strict: false)
Thread.current[:jade_tasks_test_registry] = TestRegistry
.new
.tap { it.strict = strict }
end
|
.test_registry ⇒ Object
61
62
63
|
# File 'lib/jade/tasks/rspec.rb', line 61
def self.test_registry
Thread.current[:jade_tasks_test_registry] ||= TestRegistry.new
end
|
Instance Method Details
#dispatch(task_def, *args) ⇒ Object
47
48
49
50
51
52
53
54
|
# File 'lib/jade/tasks.rb', line 47
def dispatch(task_def, *args)
block = REGISTRATIONS[task_def]
fail Unbound.new(task_def, args) unless block
block.call(Outcome, *args).tap do |value|
fail ReturnedTask.new(task_def) if value.is_a?(Jade::Task)
end
end
|
#register(task_def, &block) ⇒ Object
43
44
45
|
# File 'lib/jade/tasks.rb', line 43
def register(task_def, &block)
REGISTRATIONS[task_def] = block
end
|