Sha256: e219eda74e200d01f0bdb444eb1562a2f29c9ee3b74726b26a177ced3dabd95c

Contents?: true

Size: 843 Bytes

Versions: 13

Compression:

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

13 entries across 13 versions & 1 rubygems

Version Path
cucumber_factory-1.11.0 lib/cucumber/runtime_ext.rb
cucumber_factory-1.10.0 lib/cucumber/runtime_ext.rb
cucumber_factory-1.9.2 lib/cucumber/runtime_ext.rb
cucumber_factory-1.9.1 lib/cucumber/runtime_ext.rb
cucumber_factory-1.8.6 lib/cucumber/runtime_ext.rb
cucumber_factory-1.8.5 lib/cucumber/runtime_ext.rb
cucumber_factory-1.8.4 lib/cucumber/runtime_ext.rb
cucumber_factory-1.8.3 lib/cucumber/runtime_ext.rb
cucumber_factory-1.8.2 lib/cucumber/runtime_ext.rb
cucumber_factory-1.8.1 lib/cucumber/runtime_ext.rb
cucumber_factory-1.8.0 lib/cucumber/runtime_ext.rb
cucumber_factory-1.7.4 lib/cucumber/runtime_ext.rb
cucumber_factory-1.7.3 lib/cucumber/runtime_ext.rb