Class: Cucumber::Runtime::SupportCode

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber_priority/resolve_ambiguous_error.rb,
lib/cucumber_priority/resolve_ambiguous_error.rb

Instance Method Summary collapse

Instance Method Details

#step_match_with_priority(*args) ⇒ Object

Cucumber 2.1 or lower has a single method #step_match which returns a single Cucumber::StepMatch. This method raises Cucumber::Ambigiuous if there are two or more matches.



74
75
76
77
78
# File 'lib/cucumber_priority/resolve_ambiguous_error.rb', line 74

def step_match_with_priority(*args)
  step_match_without_priority(*args)
rescue Ambiguous => e
  CucumberPriority::Resolver.resolve_ambiguity_through_priority(e).first
end

#step_matches(*args) ⇒ Object

This method doesn’t exist in old Cucumbers. We define it so our specs have a unified API to match steps.



84
85
86
# File 'lib/cucumber_priority/resolve_ambiguous_error.rb', line 84

def step_matches(*args)
  [step_match(*args)]
end

#step_matches_with_priority(*args) ⇒ Object

Cucumber 2.3 or higher has a single method #step_matches which returns an array of Cucumber::StepMatch objects. This method raises Cucumber::Ambiguous if the array has more than one element.



54
55
56
57
58
# File 'lib/cucumber_priority/resolve_ambiguous_error.rb', line 54

def step_matches_with_priority(*args)
  step_matches_without_priority(*args)
rescue Ambiguous => e
  CucumberPriority::Resolver.resolve_ambiguity_through_priority(e)
end