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.



12
13
14
# File 'lib/cucumber/core/test/runner.rb', line 12

def initialize(event_bus)
  @event_bus = event_bus
end

Instance Method Details

#around_hook(hook, &continue) ⇒ Object



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

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

#doneObject



43
44
45
# File 'lib/cucumber/core/test/runner.rb', line 43

def done
  self
end

#test_case(test_case, &descend) ⇒ Object



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

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



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

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