Class: Cucumber::Wire::Connections

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/wire/connections.rb

Instance Method Summary collapse

Constructor Details

#initialize(connections, configuration, registry) ⇒ Connections

Returns a new instance of Connections.

Raises:

  • (ArgumentError)


19
20
21
22
23
24
# File 'lib/cucumber/wire/connections.rb', line 19

def initialize(connections, configuration, registry)
  raise ArgumentError unless connections
  @connections = connections
  @configuration = configuration
  @registry = registry
end

Instance Method Details

#begin_scenario(test_case) ⇒ Object



37
38
39
# File 'lib/cucumber/wire/connections.rb', line 37

def begin_scenario(test_case)
  connections.each { |c| c.begin_scenario(test_case) }
end

#end_scenario(test_case) ⇒ Object



41
42
43
# File 'lib/cucumber/wire/connections.rb', line 41

def end_scenario(test_case)
  connections.each { |c| c.end_scenario(test_case) }
end

#find_match(test_step) ⇒ Object



26
27
28
29
30
31
# File 'lib/cucumber/wire/connections.rb', line 26

def find_match(test_step)
  matches = step_matches(test_step.name)
  return unless matches.any?
  # TODO: handle ambiguous matches (push to cucumber?)
  matches.first
end

#snippets(code_keyword, step_name, multiline_arg_class_name) ⇒ Object



45
46
47
# File 'lib/cucumber/wire/connections.rb', line 45

def snippets(code_keyword, step_name, multiline_arg_class_name)
  connections.map { |c| c.snippet_text(code_keyword, step_name, multiline_arg_class_name) }.flatten
end

#step_matches(step_name) ⇒ Object



33
34
35
# File 'lib/cucumber/wire/connections.rb', line 33

def step_matches(step_name)
  connections.map{ |c| c.step_matches(step_name, @registry)}.flatten
end