Sha256: fd540844ffbcdc9341a1eddaee13d5e4702274979ee0637512ce482d98e24135

Contents?: true

Size: 834 Bytes

Versions: 4

Compression:

Stored size: 834 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

  class StepMother

    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

4 entries across 4 versions & 1 rubygems

Version Path
cucumber_factory-1.7.1 lib/cucumber/step_mother_ext.rb
cucumber_factory-1.7.0 lib/cucumber/step_mother_ext.rb
cucumber_factory-1.6.0 lib/cucumber/step_mother_ext.rb
cucumber_factory-1.5.0 lib/cucumber/step_mother_ext.rb