Sha256: 267dede939058a4560cf52968f74e2fd1911d0d82b47fb583e24144ddc3469ad

Contents?: true

Size: 1.38 KB

Versions: 2

Compression:

Stored size: 1.38 KB

Contents

require 'json'
require 'socket'
require 'cucumber/wire/connection'
require 'cucumber/wire/configuration'
require 'cucumber/wire/data_packet'
require 'cucumber/wire/exception'
require 'cucumber/wire/step_definition'
require 'cucumber/wire/snippet'
require 'cucumber/configuration'
require 'cucumber/step_match'

module Cucumber
  module Wire

    class Connections
      attr_reader :connections, :configuration, :registry
      private :connections

      def initialize(connections, configuration, registry)
        raise ArgumentError unless connections
        @connections = connections
        @configuration = configuration
        @registry = registry
      end

      def find_match(test_step)
        matches = step_matches(test_step.name)
        return unless matches.any?
        # TODO: handle ambiguous matches (push to cucumber?)
        matches.first
      end

      def step_matches(step_name)
        connections.map{ |c| c.step_matches(step_name, @registry)}.flatten
      end

      def begin_scenario(test_case)
        connections.each { |c| c.begin_scenario(test_case) }
      end

      def end_scenario(test_case)
        connections.each { |c| c.end_scenario(test_case) }
      end

      def snippets(code_keyword, step_name, multiline_arg_class_name)
        connections.map { |c| c.snippet_text(code_keyword, step_name, multiline_arg_class_name) }.flatten
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cucumber-wire-7.0.0 lib/cucumber/wire/connections.rb
cucumber-wire-6.2.1 lib/cucumber/wire/connections.rb