Sha256: 9c35afe5b02f100dee6789fc2f4b3249d897fb901e6c21382888b65dacc7e438

Contents?: true

Size: 839 Bytes

Versions: 3

Compression:

Stored size: 839 Bytes

Contents

require 'cucumber/runtime'

module Cucumber

  class Ambiguous

    attr_reader :matches

    def initialize_with_remembering_matches(step_name, matches, *args)
      @matches = matches
      initialize_without_remembering_matches(step_name, matches, *args)
    end

    alias_method_chain :initialize, :remembering_matches

  end

  (defined?(Runtime) ? Runtime : StepMother).class_eval do

    def step_match_with_factory_priority(*args)
      step_match_without_factory_priority(*args)
    rescue Ambiguous => e
      non_factory_matches = e.matches.reject do |match|
        Cucumber::Factory.step_definitions.include?(match.step_definition)
      end
      if non_factory_matches.size == 1
        non_factory_matches.first
      else
        raise
      end
    end

    alias_method_chain :step_match, :factory_priority

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cucumber_factory-1.11.3 lib/cucumber/runtime_ext.rb
cucumber_factory-1.11.2 lib/cucumber/runtime_ext.rb
cucumber_factory-1.11.1 lib/cucumber/runtime_ext.rb