1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/did_you_mean/helper.rb
Kevin Deisz 171803d5d3 Promote did_you_mean to default gem
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.
2019-11-30 21:08:19 -05:00

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