Class: Cucumber::Core::Test::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/core/test/runner.rb

Defined Under Namespace

Modules: StepRunner

Constant Summary collapse

STEP_RUNNER_STRATEGY =
{
  default: StepRunner::Default,
  dry_run: StepRunner::DryRun
}

Instance Method Summary collapse

Constructor Details

#initialize(report, run_options = {}) ⇒ Runner

Returns a new instance of Runner.



106
107
108
109
110
111
112
113
# File 'lib/cucumber/core/test/runner.rb', line 106

def initialize(report, run_options = {})
  @report = report

  run_mode = run_options.fetch(:run_mode) { :default }
  @step_runner_class = STEP_RUNNER_STRATEGY.fetch(run_mode) do
    raise ArgumentError, "No strategy for run mode: #{run_mode.inspect}"
  end
end

Instance Method Details

#around_hook(hook, &continue) ⇒ Object



128
129
130
# File 'lib/cucumber/core/test/runner.rb', line 128

def around_hook(hook, &continue)
  hook.call(continue)
end

#doneObject



132
133
134
135
# File 'lib/cucumber/core/test/runner.rb', line 132

def done
  report.done
  self
end

#test_case(test_case, &descend) ⇒ Object



115
116
117
118
119
120
# File 'lib/cucumber/core/test/runner.rb', line 115

def test_case(test_case, &descend)
  report.before_test_case(test_case)
  descend.call
  report.after_test_case(test_case, current_case_result)
  @current_step_runner = nil
end

#test_step(test_step) ⇒ Object



122
123
124
125
126
# File 'lib/cucumber/core/test/runner.rb', line 122

def test_step(test_step)
  report.before_test_step test_step
  step_result = current_step_runner.execute(test_step)
  report.after_test_step test_step, step_result
end