Class: Cucumber::Wire::Connections

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connections, configuration, registry) ⇒ Connections

Returns a new instance of Connections.

Raises:

  • (ArgumentError)


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

def initialize(connections, configuration, registry)
  raise ArgumentError unless connections

  @connections = connections
  @configuration = configuration
  @registry = registry
end

Instance Attribute Details

#configurationObject (readonly)

Returns the value of attribute configuration.



17
18
19
# File 'lib/cucumber/wire/connections.rb', line 17

def configuration
  @configuration
end

#registryObject (readonly)

Returns the value of attribute registry.



17
18
19
# File 'lib/cucumber/wire/connections.rb', line 17

def registry
  @registry
end

Instance Method Details

#begin_scenario(test_case) ⇒ Object



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

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

#end_scenario(test_case) ⇒ Object



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

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

#find_match(test_step) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/cucumber/wire/connections.rb', line 28

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



48
49
50
# File 'lib/cucumber/wire/connections.rb', line 48

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



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

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