Skip to content

Commit

Permalink
[rubygems/rubygems] Make tests compatible with paths that contain a +…
Browse files Browse the repository at this point in the history
  • Loading branch information
martinemde authored and hsbt committed Dec 12, 2023
1 parent 3b9ea66 commit 0e05392
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions spec/bundler/commands/info_spec.rb
Expand Up @@ -74,16 +74,16 @@

bundle "info rails --path"

expect(err).to match(/The gem rails has been deleted/i)
expect(err).to match(default_bundle_path("gems", "rails-2.3.2").to_s)
expect(err).to include("The gem rails has been deleted.")
expect(err).to include(default_bundle_path("gems", "rails-2.3.2").to_s)

bundle "info rail --path"
expect(err).to match(/The gem rails has been deleted/i)
expect(err).to match(default_bundle_path("gems", "rails-2.3.2").to_s)
expect(err).to include("The gem rails has been deleted.")
expect(err).to include(default_bundle_path("gems", "rails-2.3.2").to_s)

bundle "info rails"
expect(err).to match(/The gem rails has been deleted/i)
expect(err).to match(default_bundle_path("gems", "rails-2.3.2").to_s)
expect(err).to include("The gem rails has been deleted.")
expect(err).to include(default_bundle_path("gems", "rails-2.3.2").to_s)
end

context "given a default gem shippped in ruby", :ruby_repo do
Expand Down
8 changes: 4 additions & 4 deletions spec/bundler/commands/open_spec.rb
Expand Up @@ -44,7 +44,7 @@
G

bundle "open foo", env: { "EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => "" }
expect(out).to match("editor #{default_bundle_path.join("bundler/gems/foo-1.0-#{ref}")}")
expect(out).to include("editor #{default_bundle_path.join("bundler", "gems", "foo-1.0-#{ref}")}")
end

it "suggests alternatives for similar-sounding gems" do
Expand Down Expand Up @@ -104,7 +104,7 @@
input.puts "2"
end

expect(out).to match(%r{bundler_editor #{default_bundle_path("gems", "activerecord-2.3.2")}/CHANGELOG\.md\z})
expect(out).to include("bundler_editor #{default_bundle_path("gems", "activerecord-2.3.2").join("CHANGELOG.md")}")
end

it "opens deep subpath of the selected matching gem", :readline do
Expand All @@ -113,7 +113,7 @@
input.puts "2"
end

expect(out).to match(%r{bundler_editor #{default_bundle_path("gems", "activerecord-2.3.2")}/lib/activerecord/version\.rb\z})
expect(out).to include("bundler_editor #{default_bundle_path("gems", "activerecord-2.3.2").join("lib", "activerecord", "version.rb")}")
end

it "select the gem from many match gems", :readline do
Expand All @@ -122,7 +122,7 @@
input.puts "2"
end

expect(out).to match(/bundler_editor #{default_bundle_path("gems", "activerecord-2.3.2")}\z/)
expect(out).to include("bundler_editor #{default_bundle_path("gems", "activerecord-2.3.2")}")
end

it "allows selecting exit from many match gems", :readline do
Expand Down
8 changes: 4 additions & 4 deletions spec/bundler/commands/pristine_spec.rb
Expand Up @@ -181,8 +181,8 @@
bundle "pristine"

makefile_contents = File.read(c_ext_dir.join("Makefile").to_s)
expect(makefile_contents).to match(/libpath =.*#{c_ext_dir}/)
expect(makefile_contents).to match(/LIBPATH =.*-L#{c_ext_dir}/)
expect(makefile_contents).to match(/libpath =.*#{Regexp.escape(c_ext_dir.to_s)}/)
expect(makefile_contents).to match(/LIBPATH =.*-L#{Regexp.escape(c_ext_dir.to_s)}/)
end
end

Expand All @@ -198,8 +198,8 @@
bundle "pristine"

makefile_contents = File.read(c_ext_dir.join("Makefile").to_s)
expect(makefile_contents).to match(/libpath =.*#{c_ext_dir}/)
expect(makefile_contents).to match(/LIBPATH =.*-L#{c_ext_dir}/)
expect(makefile_contents).to match(/libpath =.*#{Regexp.escape(c_ext_dir.to_s)}/)
expect(makefile_contents).to match(/LIBPATH =.*-L#{Regexp.escape(c_ext_dir.to_s)}/)
end
end

Expand Down

0 comments on commit 0e05392

Please sign in to comment.