mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
171803d5d3
At the moment, there are some problems with regard to bundler + did_you_mean because of did_you_mean being a bundled gem. Since the vendored version of thor inside bundler and ruby itself explicitly requires did_you_mean, it can become difficult to load it when using Bundler.setup. See this issue: https://github.com/yuki24/did_you_mean/issues/117#issuecomment-482733159 for more details.
29 lines
922 B
Ruby
29 lines
922 B
Ruby
require 'test/unit'
|
|
|
|
module DidYouMean
|
|
module TestHelper
|
|
class << self
|
|
attr_reader :root
|
|
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
|