summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2021-07-31 14:10:59 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2021-08-31 19:06:14 +0900
commit0b4dbe2e6a0a0b27860fb6a509ff0429ece436c7 (patch)
tree5aa8e35b7ffe852ee7b16f97cfaab9872b71e925 /spec
parent2e850e0038e8ba9a5dd3266e9f0f6b2821f19084 (diff)
[rubygems/rubygems] Improve "gem not found in source" errors
When printing sources inside these error messages, it's useful to only consider the current state of the source. For example, when requiring `bundler/setup`, the source shouldn't be configured to be able to hit the network, so the error message should only mention "locally installed gems" to make that more clear. https://github.com/rubygems/rubygems/commit/30eb14f853
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4789
Diffstat (limited to 'spec')
-rw-r--r--spec/bundler/commands/exec_spec.rb4
-rw-r--r--spec/bundler/commands/lock_spec.rb2
-rw-r--r--spec/bundler/support/indexes.rb2
3 files changed, 4 insertions, 4 deletions
diff --git a/spec/bundler/commands/exec_spec.rb b/spec/bundler/commands/exec_spec.rb
index 68c4726608..c6648f0a7a 100644
--- a/spec/bundler/commands/exec_spec.rb
+++ b/spec/bundler/commands/exec_spec.rb
@@ -836,7 +836,7 @@ RSpec.describe "bundle exec" do
let(:exit_code) { Bundler::GemNotFound.new.status_code }
let(:expected) { "" }
let(:expected_err) { <<-EOS.strip }
-Could not find gem 'rack (= 2)' in rubygems repository #{file_uri_for(gem_repo1)}/ or installed locally.
+Could not find gem 'rack (= 2)' in locally installed gems.
The source contains the following versions of 'rack': 0.9.1, 1.0.0
Run `bundle install` to install missing gems.
EOS
@@ -863,7 +863,7 @@ Run `bundle install` to install missing gems.
let(:exit_code) { Bundler::GemNotFound.new.status_code }
let(:expected) { "" }
let(:expected_err) { <<-EOS.strip }
-Could not find gem 'rack (= 2)' in rubygems repository #{file_uri_for(gem_repo1)}/ or installed locally.
+Could not find gem 'rack (= 2)' in locally installed gems.
The source contains the following versions of 'rack': 1.0.0
Run `bundle install` to install missing gems.
EOS
diff --git a/spec/bundler/commands/lock_spec.rb b/spec/bundler/commands/lock_spec.rb
index 21eb6e5456..171ec1ba1d 100644
--- a/spec/bundler/commands/lock_spec.rb
+++ b/spec/bundler/commands/lock_spec.rb
@@ -86,7 +86,7 @@ RSpec.describe "bundle lock" do
it "does not fetch remote specs when using the --local option" do
bundle "lock --update --local", :raise_on_error => false
- expect(err).to match(/installed locally/)
+ expect(err).to match(/locally installed gems/)
end
it "works with --gemfile flag" do
diff --git a/spec/bundler/support/indexes.rb b/spec/bundler/support/indexes.rb
index bf4300edb2..91dd699b5f 100644
--- a/spec/bundler/support/indexes.rb
+++ b/spec/bundler/support/indexes.rb
@@ -17,7 +17,7 @@ module Spec
def resolve(args = [])
@platforms ||= ["ruby"]
deps = []
- default_source = instance_double("Bundler::Source::Rubygems", :specs => @index)
+ default_source = instance_double("Bundler::Source::Rubygems", :specs => @index, :to_err => "locally install gems")
source_requirements = { :default => default_source }
@deps.each do |d|
source_requirements[d.name] = d.source = default_source