class Cucumber::Filters::PrepareWorld::CaseFilter

Public Class Methods

new(runtime, original_test_case) click to toggle source
# File lib/cucumber/filters/prepare_world.rb, line 14
def initialize(runtime, original_test_case)
  @runtime, @original_test_case = runtime, original_test_case
end

Public Instance Methods

test_case() click to toggle source
# File lib/cucumber/filters/prepare_world.rb, line 18
def test_case
  init_scenario = Cucumber::Hooks.around_hook(@original_test_case.source) do |continue|
    @runtime.begin_scenario(scenario)
    continue.call
    @runtime.end_scenario(scenario)
  end
  around_hooks = [init_scenario] + @original_test_case.around_hooks

  empty_hook = proc {} # no op - legacy format adapter expects a before hooks
  empty_hook_location = Cucumber::Core::Ast::Location.from_source_location(*empty_hook.source_location)
  default_hook = Cucumber::Hooks.before_hook(@original_test_case.source, empty_hook_location, &empty_hook)
  steps = [default_hook] + @original_test_case.test_steps

  @original_test_case.with_around_hooks(around_hooks).with_steps(steps)
end

Private Instance Methods

scenario() click to toggle source
# File lib/cucumber/filters/prepare_world.rb, line 36
def scenario
  @scenario ||= RunningTestCase.new(test_case)
end