class Cucumber::StepMatch

Public Instance Methods

invoke_with_neverfails(multiline_arg) click to toggle source
# File lib/neverfails.rb, line 5
def invoke_with_neverfails(multiline_arg)
  begin
    invoke_without_neverfails(multiline_arg)
  rescue Exception => e # NOTE: Test::Unit::AssertionFailedError
    match1 = /No model found called (.+?)\.$/.match(e.message)
    match2 = /No URL pattern found matching \/(.+?)\.$/.match(e.message)
    match3 = /The text "(.+?)" was not found in the current page$/.match(e.message)
    if match1
      create_missing_model match1[1]
    elsif match2
      create_missing_page_listing match2[1]
    elsif match3
      create_missing_text match3[1]
    else
      raise
    end
    return invoke_without_neverfails(multiline_arg) # Try again
  end
end