Class: Cucumber::Core::Test::HookCompiler

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

Defined Under Namespace

Classes: HookMapper

Instance Method Summary collapse

Instance Method Details

#after_hook(hook) ⇒ Object



64
65
66
# File 'lib/cucumber/core/test/hook_compiler.rb', line 64

def after_hook(hook)
  @after_hooks << hook
end

#around_hook(hook) ⇒ Object



68
69
70
# File 'lib/cucumber/core/test/hook_compiler.rb', line 68

def around_hook(hook)
  @around_hooks << hook
end

#before_hook(hook) ⇒ Object



60
61
62
# File 'lib/cucumber/core/test/hook_compiler.rb', line 60

def before_hook(hook)
  @before_hooks << hook
end

#doneObject



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

def done
  receiver.done
  self
end

#test_case(test_case, &descend) ⇒ Object



49
50
51
52
53
54
55
56
57
58
# File 'lib/cucumber/core/test/hook_compiler.rb', line 49

def test_case(test_case, &descend)
  @before_hooks, @after_hooks, @around_hooks, @steps = [], [], [], []
  mapper = HookMapper.new(self, test_case.source)
  test_case.describe_to mappings, mapper
  descend.call
  test_case.
    with_steps(@before_hooks + @steps + @after_hooks).
    with_around_hooks(@around_hooks).
    describe_to(receiver)
end

#test_step(step) ⇒ Object



72
73
74
# File 'lib/cucumber/core/test/hook_compiler.rb', line 72

def test_step(step)
  @steps << step
end