Skip to content

Commit d95f7a3

Browse files
deivid-rodriguezhsbt
authored andcommitted
[rubygems/rubygems] Extract stdboth spec helper
ruby/rubygems@bb13f4e702
1 parent ee55b82 commit d95f7a3

File tree

15 files changed

+36
-32
lines changed

15 files changed

+36
-32
lines changed

spec/bundler/bundler/cli_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def out_with_macos_man_workaround
179179
shared_examples_for "no warning" do
180180
it "prints no warning" do
181181
bundle "fail", env: { "BUNDLER_VERSION" => bundler_version }, raise_on_error: false
182-
expect(last_command.stdboth).to eq("Could not find command \"fail\".")
182+
expect(stdboth).to eq("Could not find command \"fail\".")
183183
end
184184
end
185185

@@ -228,10 +228,10 @@ def out_with_macos_man_workaround
228228
context "running a parseable command" do
229229
it "prints no warning" do
230230
bundle "config get --parseable foo", env: { "BUNDLER_VERSION" => bundler_version }
231-
expect(last_command.stdboth).to eq ""
231+
expect(stdboth).to eq ""
232232

233233
bundle "platform --ruby", env: { "BUNDLER_VERSION" => bundler_version }, raise_on_error: false
234-
expect(last_command.stdboth).to eq "Could not locate Gemfile"
234+
expect(stdboth).to eq "Could not locate Gemfile"
235235
end
236236
end
237237

spec/bundler/commands/install_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@
260260
gem "myrack"
261261
G
262262

263-
expect(last_command.stdboth).to include(plugin_msg)
263+
expect(stdboth).to include(plugin_msg)
264264
end
265265

266266
describe "with a gem that installs multiple platforms" do
@@ -722,7 +722,7 @@
722722
gem "ajp-rails", "0.0.0"
723723
G
724724

725-
expect(last_command.stdboth).not_to match(/Error Report/i)
725+
expect(stdboth).not_to match(/Error Report/i)
726726
expect(err).to include("An error occurred while installing ajp-rails (0.0.0), and Bundler cannot continue.").
727727
and include("Bundler::APIResponseInvalidDependenciesError")
728728
end

spec/bundler/commands/newgem_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ def ignore_paths
529529
system_gems gems, path: path, gem_repo: gem_repo2
530530
bundle "exec rake build", dir: bundled_app("newgem")
531531

532-
expect(last_command.stdboth).not_to include("ERROR")
532+
expect(stdboth).not_to include("ERROR")
533533
end
534534

535535
context "gem naming with relative paths" do

spec/bundler/commands/update_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,7 +1140,7 @@
11401140
end
11411141

11421142
bundle "update thin myrack-obama"
1143-
expect(last_command.stdboth).to include "Bundler attempted to update myrack-obama but its version stayed the same"
1143+
expect(stdboth).to include "Bundler attempted to update myrack-obama but its version stayed the same"
11441144
expect(the_bundle).to include_gems "thin 2.0", "myrack 10.0", "myrack-obama 1.0"
11451145
end
11461146

@@ -1158,7 +1158,7 @@
11581158

11591159
bundle "update foo"
11601160

1161-
expect(last_command.stdboth).not_to include "attempted to update"
1161+
expect(stdboth).not_to include "attempted to update"
11621162
end
11631163

11641164
it "will not warn when changing gem sources but not versions" do
@@ -1176,7 +1176,7 @@
11761176

11771177
bundle "update myrack"
11781178

1179-
expect(last_command.stdboth).not_to include "attempted to update"
1179+
expect(stdboth).not_to include "attempted to update"
11801180
end
11811181

11821182
it "will update only from pinned source" do
@@ -1266,7 +1266,7 @@
12661266
it "is not updated because it is not actually included in the bundle" do
12671267
simulate_platform "x86_64-linux" do
12681268
bundle "update a"
1269-
expect(last_command.stdboth).to include "Bundler attempted to update a but it was not considered because it is for a different platform from the current one"
1269+
expect(stdboth).to include "Bundler attempted to update a but it was not considered because it is for a different platform from the current one"
12701270
expect(the_bundle).to_not include_gem "a"
12711271
end
12721272
end
@@ -1307,7 +1307,7 @@
13071307

13081308
it "should explain that bundler conflicted and how to resolve the conflict" do
13091309
bundle "update", all: true, raise_on_error: false
1310-
expect(last_command.stdboth).not_to match(/in snapshot/i)
1310+
expect(stdboth).not_to match(/in snapshot/i)
13111311
expect(err).to match(/current Bundler version/i).
13121312
and match(/Install the necessary version with `gem install bundler:9\.9\.9`/i)
13131313
end

spec/bundler/install/allow_offline_install_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
G
4444

4545
bundle :update, artifice: "fail", all: true
46-
expect(last_command.stdboth).to include "Using the cached data for the new index because of a network error"
46+
expect(stdboth).to include "Using the cached data for the new index because of a network error"
4747

4848
expect(the_bundle).to include_gems("myrack-obama 1.0", "myrack 1.0.0")
4949
end

spec/bundler/install/gemfile/gemspec_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@
192192
install_gemfile <<-G, raise_on_error: false
193193
gemspec :path => '#{tmp("foo")}'
194194
G
195-
expect(last_command.stdboth).not_to include("ahh")
195+
expect(stdboth).not_to include("ahh")
196196
end
197197

198198
it "allows the gemspec to activate other gems" do

spec/bundler/install/gemfile/git_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1673,7 +1673,7 @@
16731673
end
16741674
G
16751675

1676-
expect(last_command.stdboth).to_not include("password1")
1676+
expect(stdboth).to_not include("password1")
16771677
expect(out).to include("Fetching https://[email protected]/company/private-repo")
16781678
end
16791679
end
@@ -1689,7 +1689,7 @@
16891689
end
16901690
G
16911691

1692-
expect(last_command.stdboth).to_not include("oauth_token")
1692+
expect(stdboth).to_not include("oauth_token")
16931693
expect(out).to include("Fetching https://[email protected]/company/private-repo")
16941694
end
16951695
end

spec/bundler/install/gemfile/groups_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@
397397
FileUtils.rm_r gem_repo2
398398
bundle "config set --local without myrack"
399399
bundle :install, verbose: true
400-
expect(last_command.stdboth).not_to match(/fetching/i)
400+
expect(stdboth).not_to match(/fetching/i)
401401
end
402402
end
403403
end

spec/bundler/install/gems/compact_index_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ def require(*args)
313313
gem "myrack"
314314
G
315315

316-
expect(last_command.stdboth).not_to include "Double checking"
316+
expect(stdboth).not_to include "Double checking"
317317
end
318318

319319
it "fetches again when more dependencies are found in subsequent sources", bundler: "< 3" do

spec/bundler/other/cli_dispatch_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
it "work when given fully" do
55
bundle "install", raise_on_error: false
66
expect(err).to eq("Could not locate Gemfile")
7-
expect(last_command.stdboth).not_to include("Ambiguous command")
7+
expect(stdboth).not_to include("Ambiguous command")
88
end
99

1010
it "work when not ambiguous" do
1111
bundle "ins", raise_on_error: false
1212
expect(err).to eq("Could not locate Gemfile")
13-
expect(last_command.stdboth).not_to include("Ambiguous command")
13+
expect(stdboth).not_to include("Ambiguous command")
1414
end
1515

1616
it "print a friendly error when ambiguous" do

0 commit comments

Comments
 (0)