class FunctionalLightService::Testing::ContextFactory
Attributes
organizer[R]
Public Class Methods
make_from(organizer)
click to toggle source
# File lib/functional-light-service/testing/context_factory.rb, line 6 def self.make_from(organizer) new(organizer) end
new(organizer)
click to toggle source
# File lib/functional-light-service/testing/context_factory.rb, line 35 def initialize(organizer) @organizer = organizer end
Public Instance Methods
for(action)
click to toggle source
# File lib/functional-light-service/testing/context_factory.rb, line 10 def for(action) @organizer.append_before_actions( ->(ctx) do if ctx.current_action == action # The last `:_before_actions` hook is for # ContextFactory, remove it, so it won't # be invoked again ctx[:_before_actions].pop throw(:return_ctx_from_execution, ctx) end end ) self end
with(*args, &block)
click to toggle source
More than one arguments can be passed to the Organizer's call method
# File lib/functional-light-service/testing/context_factory.rb, line 29 def with(*args, &block) catch(:return_ctx_from_execution) do @organizer.call(*args, &block) end end