aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorCody Cutrer <cody@instructure.com>2024-04-11 10:21:01 -0600
committergit <svn-admin@ruby-lang.org>2024-04-11 19:35:28 +0000
commitc5e661b1d720cf5452c3fd5264b73063ca9c4515 (patch)
treea2389f91d399cc59ce7609bde4710b727aa052ef /spec
parentcd516ebd20a8d2c7b0f912e4d5750f84616463a5 (diff)
downloadruby-c5e661b1d720cf5452c3fd5264b73063ca9c4515.tar.gz
[rubygems/rubygems] Fix installing plugins via relative paths
This affected both CLI and Gemfile installs https://github.com/rubygems/rubygems/commit/a0d101a8df
Diffstat (limited to 'spec')
-rw-r--r--spec/bundler/plugins/install_spec.rb55
1 files changed, 49 insertions, 6 deletions
diff --git a/spec/bundler/plugins/install_spec.rb b/spec/bundler/plugins/install_spec.rb
index 61c513ed72..20c2f1fd26 100644
--- a/spec/bundler/plugins/install_spec.rb
+++ b/spec/bundler/plugins/install_spec.rb
@@ -212,14 +212,42 @@ RSpec.describe "bundler plugin install" do
end
end
- it "installs from a path source" do
- build_lib "path_plugin" do |s|
- s.write "plugins.rb"
+ context "path plugins" do
+ it "installs from a path source" do
+ build_lib "path_plugin" do |s|
+ s.write "plugins.rb"
+ end
+ bundle "plugin install path_plugin --path #{lib_path("path_plugin-1.0")}"
+
+ expect(out).to include("Installed plugin path_plugin")
+ plugin_should_be_installed("path_plugin")
+ end
+
+ it "installs from a relative path source" do
+ build_lib "path_plugin" do |s|
+ s.write "plugins.rb"
+ end
+ path = lib_path("path_plugin-1.0").relative_path_from(bundled_app)
+ bundle "plugin install path_plugin --path #{path}"
+
+ expect(out).to include("Installed plugin path_plugin")
+ plugin_should_be_installed("path_plugin")
end
- bundle "plugin install path_plugin --path #{lib_path("path_plugin-1.0")}"
- expect(out).to include("Installed plugin path_plugin")
- plugin_should_be_installed("path_plugin")
+ it "installs from a relative path source when inside an app" do
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
+ gemfile ""
+
+ build_lib "ga-plugin" do |s|
+ s.write "plugins.rb"
+ end
+
+ path = lib_path("ga-plugin-1.0").relative_path_from(bundled_app)
+ bundle "plugin install ga-plugin --path #{path}"
+
+ plugin_should_be_installed("ga-plugin")
+ expect(local_plugin_gem("foo-1.0")).not_to be_directory
+ end
end
context "Gemfile eval" do
@@ -291,6 +319,21 @@ RSpec.describe "bundler plugin install" do
plugin_should_be_installed("ga-plugin")
end
+ it "accepts relative path sources" do
+ build_lib "ga-plugin" do |s|
+ s.write "plugins.rb"
+ end
+
+ path = lib_path("ga-plugin-1.0").relative_path_from(bundled_app)
+ install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
+ plugin 'ga-plugin', :path => "#{path}"
+ G
+
+ expect(out).to include("Installed plugin ga-plugin")
+ plugin_should_be_installed("ga-plugin")
+ end
+
context "in deployment mode" do
it "installs plugins" do
install_gemfile <<-G