Sha256: 7ebb90e5a4ff5bde774ff5556ef0d62b4eabffa2812c530b56c3e163c2e4f9e0

Contents?: true

Size: 1014 Bytes

Versions: 1

Compression:

Stored size: 1014 Bytes

Contents

require 'test/unit'

module DidYouMean
  module TestHelper
    class << self
      attr_reader :root

      def ractor_compatible?
        defined?(Ractor) && RUBY_VERSION >= "3.1.0"
      end
    end

    if File.file?(File.expand_path('../lib/did_you_mean.rb', __dir__))
      # In this case we're being run from inside the gem, so we just want to
      # require the root of the library

      @root = File.expand_path('../lib/did_you_mean', __dir__)
      require_relative @root
    else
      # In this case we're being run from inside ruby core, and we want to
      # include the experimental features in the test suite

      @root = File.expand_path('../../lib/did_you_mean', __dir__)
      require_relative @root
      # We are excluding experimental features for now.
      # require_relative File.join(@root, 'experimental')
    end

    def assert_correction(expected, array)
      assert_equal Array(expected), array, "Expected #{array.inspect} to only include #{expected.inspect}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
did_you_mean-1.6.1 test/helper.rb