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

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

Defined Under Namespace

Classes: RunningTestCase

Instance Method Summary collapse

Constructor Details

#initialize(event_bus) ⇒ Runner

Returns a new instance of Runner.



14
15
16
# File 'lib/cucumber/core/test/runner.rb', line 14

def initialize(event_bus)
  @event_bus = event_bus
end

Instance Method Details

#around_hook(hook) ⇒ Object



38
39
40
41
42
43
# File 'lib/cucumber/core/test/runner.rb', line 38

def around_hook(hook, &)
  result = running_test_case.execute(hook, &)
  event_bus.test_step_finished running_test_step, result if running_test_step
  @running_test_step = nil
  self
end

#doneObject



45
46
47
# File 'lib/cucumber/core/test/runner.rb', line 45

def done
  self
end

#test_case(test_case, &descend) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/cucumber/core/test/runner.rb', line 18

def test_case(test_case, &descend)
  @running_test_case = RunningTestCase.new
  @running_test_step = nil
  event_bus.test_case_started(test_case)
  descend.call(self)
  result = running_test_case.result
  result = Result::Undefined.new('The test case has no steps', Result::UnknownDuration.new, ["#{test_case.location}:in `#{test_case.name}'"]) if result.unknown?
  event_bus.test_case_finished(test_case, result)
  self
end

#test_step(test_step) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/cucumber/core/test/runner.rb', line 29

def test_step(test_step)
  @running_test_step = test_step
  event_bus.test_step_started test_step
  step_result = running_test_case.execute(test_step)
  event_bus.test_step_finished test_step, step_result
  @running_test_step = nil
  self
end