Sha256: b87d4d3f7ed515ca5c7c01830c1de622e472f60544c4ec53715a5499ee1d8697

Contents?: true

Size: 1.18 KB

Versions: 40

Compression:

Stored size: 1.18 KB

Contents

module Cucumber
  module CucumberExpressions
    class CucumberExpressionError < StandardError
    end

    class UndefinedParameterTypeError < CucumberExpressionError
      def initialize(type_name)
        super("Undefined parameter type {#{type_name}}")
      end
    end

    class AmbiguousParameterTypeError < CucumberExpressionError
      def initialize(parameter_type_regexp, expression_regexp, parameter_types, generated_expressions)
        super(<<-EOM)
Your Regular Expression /#{expression_regexp.source}/
matches multiple parameter types with regexp /#{parameter_type_regexp}/:
   #{parameter_type_names(parameter_types)}

I couldn't decide which one to use. You have two options:

1) Use a Cucumber Expression instead of a Regular Expression. Try one of these:
   #{expressions(generated_expressions)}

2) Make one of the parameter types preferential and continue to use a Regular Expression.

        EOM
      end

      private

      def parameter_type_names(parameter_types)
        parameter_types.map{|p| "{#{p.name}}"}.join("\n   ")
      end

      def expressions(generated_expressions)
        generated_expressions.map{|ge| ge.source}.join("\n   ")
      end
    end
  end
end

Version data entries

40 entries across 40 versions & 3 rubygems

Version Path
cucumber-cucumber-expressions-10.3.0 lib/cucumber/cucumber_expressions/errors.rb
cucumber-cucumber-expressions-10.2.2 lib/cucumber/cucumber_expressions/errors.rb
cucumber-cucumber-expressions-10.2.1 lib/cucumber/cucumber_expressions/errors.rb
cucumber-cucumber-expressions-10.2.0 lib/cucumber/cucumber_expressions/errors.rb
cucumber-cucumber-expressions-10.1.0 lib/cucumber/cucumber_expressions/errors.rb
cucumber-cucumber-expressions-10.0.0 lib/cucumber/cucumber_expressions/errors.rb
cucumber-cucumber-expressions-9.0.0 lib/cucumber/cucumber_expressions/errors.rb
cucumber-cucumber-expressions-8.3.1 lib/cucumber/cucumber_expressions/errors.rb
cucumber-expressions-8.3.0 lib/cucumber/cucumber_expressions/errors.rb
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/cucumber-expressions-6.0.1/lib/cucumber/cucumber_expressions/errors.rb
cucumber-expressions-8.2.1 lib/cucumber/cucumber_expressions/errors.rb
cucumber-expressions-8.2.0 lib/cucumber/cucumber_expressions/errors.rb
cucumber-expressions-8.1.0 lib/cucumber/cucumber_expressions/errors.rb
cucumber-expressions-8.0.2 lib/cucumber/cucumber_expressions/errors.rb
cucumber-expressions-8.0.1 lib/cucumber/cucumber_expressions/errors.rb
cucumber-expressions-8.0.0 lib/cucumber/cucumber_expressions/errors.rb
cucumber-expressions-7.0.0 lib/cucumber/cucumber_expressions/errors.rb
cucumber-expressions-6.6.2 lib/cucumber/cucumber_expressions/errors.rb
cucumber-expressions-6.0.1 lib/cucumber/cucumber_expressions/errors.rb
cucumber-expressions-6.0.0 lib/cucumber/cucumber_expressions/errors.rb