summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/bundler/cli/common.rb10
-rw-r--r--spec/bundler/bundler/cli_common_spec.rb12
2 files changed, 12 insertions, 10 deletions
diff --git a/lib/bundler/cli/common.rb b/lib/bundler/cli/common.rb
index a756e8eed3..c0eefadf51 100644
--- a/lib/bundler/cli/common.rb
+++ b/lib/bundler/cli/common.rb
@@ -96,8 +96,8 @@ module Bundler
def self.gem_not_found_message(missing_gem_name, alternatives)
require "did_you_mean/spell_checker"
message = "Could not find gem '#{missing_gem_name}'."
- alternate_names = alternatives.map { |a| a.respond_to?(:name) ? a.name : a }
- suggestions = DidYouMean::SpellChecker.new(dictionary: alternate_names).correct(missing_gem_name)
+ alternate_names = alternatives.map {|a| a.respond_to?(:name) ? a.name : a }
+ suggestions = DidYouMean::SpellChecker.new(:dictionary => alternate_names).correct(missing_gem_name)
message += "\nDid you mean #{word_list(suggestions)}?" unless suggestions.empty?
message
end
@@ -135,14 +135,14 @@ module Bundler
clean
end
- protected
+ protected
def self.word_list(words)
if words.empty?
- return ''
+ return ""
end
- words = words.map { |word| "'#{word}'" }
+ words = words.map {|word| "'#{word}'" }
if words.length == 1
return words[0]
diff --git a/spec/bundler/bundler/cli_common_spec.rb b/spec/bundler/bundler/cli_common_spec.rb
index de29d73265..ab7d69b969 100644
--- a/spec/bundler/bundler/cli_common_spec.rb
+++ b/spec/bundler/bundler/cli_common_spec.rb
@@ -1,9 +1,11 @@
-require 'bundler/cli'
+# frozen_string_literal: true
+
+require "bundler/cli"
RSpec.describe Bundler::CLI::Common do
- describe 'gem_not_found_message' do
- it 'should suggest alternate gem names' do
- message = subject.gem_not_found_message('ralis', ['BOGUS'])
+ describe "gem_not_found_message" do
+ it "should suggest alternate gem names" do
+ message = subject.gem_not_found_message("ralis", ["BOGUS"])
expect(message).to match("Could not find gem 'ralis'.$")
message = subject.gem_not_found_message("ralis", ["rails"])
expect(message).to match("Did you mean 'rails'?")
@@ -15,4 +17,4 @@ RSpec.describe Bundler::CLI::Common do
expect(message).to match("Did you mean 'methods' or 'method'?")
end
end
-end \ No newline at end of file
+end