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) ⇒ Connections

Returns a new instance of Connections.

Raises:

  • (ArgumentError)


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

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

Instance Method Details

#begin_scenario(test_case) ⇒ Object



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

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

#end_scenario(test_case) ⇒ Object



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

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

#find_match(test_step) ⇒ Object



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

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



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

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



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

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