Module: Trailblazer::Activity::Testing
- Defined in:
- lib/trailblazer/activity/testing.rb
Defined Under Namespace
Modules: Assertions
Class Method Summary collapse
-
.def_steps(*names) ⇒ Object
Creates a module with one step method for each name.
-
.def_task(name) ⇒ Object
Creates a method instance with a task interface.
- .def_tasks(*names) ⇒ Object
-
.render_task(proc) ⇒ Object
Use this in #Cct.
Class Method Details
.def_steps(*names) ⇒ Object
Creates a module with one step method for each name.
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/trailblazer/activity/testing.rb', line 10 def self.def_steps(*names) Module.new do module_function names.each do |name| define_method(name) do |ctx, **| ctx[:seq] << name ctx.key?(name) ? ctx[name] : true end end end end |
.def_task(name) ⇒ Object
Creates a method instance with a task interface.
27 28 29 |
# File 'lib/trailblazer/activity/testing.rb', line 27 def self.def_task(name) def_tasks(name).method(name) end |
.def_tasks(*names) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/trailblazer/activity/testing.rb', line 31 def self.def_tasks(*names) Module.new do module_function names.each do |name| define_method(name) do |(ctx, ), **| ctx[:seq] << name signal = ctx.key?(name) ? ctx[name] : Activity::Right return signal, [ctx, ] end end end end |
.render_task(proc) ⇒ Object
Use this in #Cct.
107 108 109 |
# File 'lib/trailblazer/activity/testing.rb', line 107 def self.render_task(proc) Activity::Introspect.render_task(proc) end |