8000 [rubygems/rubygems] Consistently use instance variables directly · Shopify/ruby@3319d3d · GitHub
[go: up one dir, main page]

Skip to content

Commit 3319d3d

Browse files
deivid-rodriguezhsbt
authored andcommitted
[rubygems/rubygems] Consistently use instance variables directly
I don't think the indirection improve things. rubygems/rubygems@b408b28844
1 parent 0a62e82 commit 3319d3d

File tree

1 file changed

+19
-22
lines changed

1 file changed

+19
-22
lines changed

spec/bundler/install/gems/mirror_probe_spec.rb

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# frozen_string_literal: true
22

33
RSpec.describe "fetching dependencies with a not available mirror" do
4-
let(:mirror) { @mirror_uri }
5-
let(:original) { @server_uri }
6-
let(:server_port) { @server_port }
74
let(:host) { "127.0.0.1" }
85

96
before do
@@ -20,13 +17,13 @@
2017

2118
context "with a specific fallback timeout" do
2219
before do
23-
global_config("BUNDLE_MIRROR__HTTP://127__0__0__1:#{server_port}/__FALLBACK_TIMEOUT/" => "true",
24-
"BUNDLE_MIRROR__HTTP://127__0__0__1:#{server_port}/" => mirror)
20+
global_config("BUNDLE_MIRROR__HTTP://127__0__0__1:#{@server_port}/__FALLBACK_TIMEOUT/" => "true",
21+
"BUNDLE_MIRROR__HTTP://127__0__0__1:#{@server_port}/" => @mirror_uri)
2522
end
2623

2724
it "install a gem using the original uri when the mirror is not responding" do
2825
gemfile <<-G
29-
source "#{original}"
26+
source "#{@server_uri}"
3027
gem 'weakling'
3128
G
3229

@@ -41,12 +38,12 @@
4138
context "with a global fallback timeout" do
4239
before do
4340
global_config("BUNDLE_MIRROR__ALL__FALLBACK_TIMEOUT/" => "1",
44-
"BUNDLE_MIRROR__ALL" => mirror)
41+
"BUNDLE_MIRROR__ALL" => @mirror_uri)
4542
end
4643

4744
it "install a gem using the original uri when the mirror is not responding" do
4845
gemfile <<-G
49-
source "#{original}"
46+
source "#{@server_uri}"
5047
gem 'weakling'
5148
G
5249

@@ -60,47 +57,47 @@
6057

6158
context "with a specific mirror without a fallback timeout" do
6259
before do
63-
global_config("BUNDLE_MIRROR__HTTP://127__0__0__1:#{server_port}/" => mirror)
60+
global_config("BUNDLE_MIRROR__HTTP://127__0__0__1:#{@server_port}/" => @mirror_uri)
6461
end
6562

6663
it "fails to install the gem with a timeout error" do
6764
gemfile <<-G
68-
source "#{original}"
65+
source "#{@server_uri}"
6966
gem 'weakling'
7067
G
7168

7269
bundle :install, artifice: nil, raise_on_error: false
7370

74-
expect(out).to include("Fetching source index from #{mirror}")
71+
expect(out).to include("Fetching source index from #{@mirror_uri}")
7572

7673
err_lines = err.split("\n")
77-
expect(err_lines).to include(%r{\ARetrying fetcher due to error \(2/4\): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error <})
78-
expect(err_lines).to include(%r{\ARetrying fetcher due to error \(3/4\): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error <})
79-
expect(err_lines).to include(%r{\ARetrying fetcher due to error \(4/4\): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error <})
80-
expect(err_lines).to include(%r{\ACould not fetch specs from #{mirror}/ due to underlying error <})
74+
expect(err_lines).to include(%r{\ARetrying fetcher due to error \(2/4\): Bundler::HTTPError Could not fetch specs from #{@mirror_uri}/ due to underlying error <})
75+
expect(err_lines).to include(%r{\ARetrying fetcher due to error \(3/4\): Bundler::HTTPError Could not fetch specs from #{@mirror_uri}/ due to underlying error <})
76+
expect(err_lines).to include(%r{\ARetrying fetcher due to error \(4/4\): Bundler::HTTPError Could not fetch specs from #{@mirror_uri}/ due to underlying error <})
77+
expect(err_lines).to include(%r{\ACould not fetch specs from #{@mirror_uri}/ due to underlying error <})
8178
end
8279
end
8380

8481
context "with a global mirror without a fallback timeout" do
8582
before do
86-
global_config("BUNDLE_MIRROR__ALL" => mirror)
83+
global_config("BUNDLE_MIRROR__ALL" => @mirror_uri)
8784
end
8885

8986
it "fails to install the gem with a timeout error" do
9087
gemfile <<-G
91-
source "#{original}"
88+
source "#{@server_uri}"
9289
gem 'weakling'
9390
G
9491

9592
bundle :install, artifice: nil, raise_on_error: false
9693

97-
expect(out).to include("Fetching source index from #{mirror}")
94+
expect(out).to include("Fetching source index from #{@mirror_uri}")
9895

9996
err_lines = err.split("\n")
100-
expect(err_lines).to include(%r{\ARetrying fetcher due to error \(2/4\): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error <})
101-
expect(err_lines).to include(%r{\ARetrying fetcher due to error \(3/4\): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error <})
102-
expect(err_lines).to include(%r{\ARetrying fetcher due to error \(4/4\): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error <})
103-
expect(err_lines).to include(%r{\ACould not fetch specs from #{mirror}/ due to underlying error <})
97+
expect(err_lines).to include(%r{\ARetrying fetcher due to error \(2/4\): Bundler::HTTPError Could not fetch specs from #{@mirror_uri}/ due to underlying error <})
98+
expect(err_lines).to include(%r{\ARetrying fetcher due to error \(3/4\): Bundler::HTTPError Could not fetch specs from #{@mirror_uri}/ due to underlying error <})
99+
expect(err_lines).to include(%r{\ARetrying fetcher due to error \(4/ 4EF8 4\): Bundler::HTTPError Could not fetch specs from #{@mirror_uri}/ due to underlying error <})
100+
expect(err_lines).to include(%r{\ACould not fetch specs from #{@mirror_uri}/ due to underlying error <})
104101
end
105102
end
106103

0 commit comments

Comments
 (0)
0