Sha256: eac0647cddacba8710a940cd07f3de248755971c5c05e784b6d25d37c6bf9a2c

Contents?: true

Size: 873 Bytes

Versions: 1

Compression:

Stored size: 873 Bytes

Contents

require 'cucumber/step_mother'

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
      matched_definitions = e.matches.collect(&:step_definition)
      if matched_definitions.size == 2 && (Cucumber::Factory.step_definitions & matched_definitions).any?
        (matched_definitions - Cucumber::Factory.step_definitions).first
      else
        raise
      end
    end

    alias_method_chain :step_match, :factory_priority

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cucumber_factory-1.7.2 lib/cucumber/runtime_ext.rb