|
19 | 19 | expect(out).to eq("LOCAL") |
20 | 20 | end |
21 | 21 |
|
| 22 | + it "resolves a relative local override against the project root from a subdirectory" do |
| 23 | + local = lib_path("local-myrack") |
| 24 | + build_git "myrack", "0.8", path: local |
| 25 | + |
| 26 | + gemfile <<-G |
| 27 | + source "https://gem.repo1" |
| 28 | + gem "myrack", :git => "#{lib_path("myrack-0.8")}", :branch => "main" |
| 29 | + G |
| 30 | + |
| 31 | + env = { "BUNDLE_LOCAL__MYRACK" => local.relative_path_from(bundled_app).to_s } |
| 32 | + bundle :install, env: env |
| 33 | + bundle :check, dir: bundled_app("subdir").mkpath, env: env |
| 34 | + expect(out).to include("The Gemfile's dependencies are satisfied") |
| 35 | + end |
| 36 | + |
| 37 | + it "expands a home-relative local override" do |
| 38 | + build_git "myrack", "0.8", path: home("local-myrack") |
| 39 | + |
| 40 | + gemfile <<-G |
| 41 | + source "https://gem.repo1" |
| 42 | + gem "myrack", :git => "#{lib_path("myrack-0.8")}", :branch => "main" |
| 43 | + G |
| 44 | + |
| 45 | + bundle :install, env: { "BUNDLE_LOCAL__MYRACK" => "~/local-myrack" } |
| 46 | + expect(out).to include("Bundle complete!") |
| 47 | + end |
| 48 | + |
| 49 | + it "reports a Git error for a local override with an unknown home directory" do |
| 50 | + skip "problems with ~ expansion" if Gem.win_platform? |
| 51 | + |
| 52 | + gemfile <<-G |
| 53 | + source "https://gem.repo1" |
| 54 | + gem "myrack", :git => "#{lib_path("myrack-0.8")}", :branch => "main" |
| 55 | + G |
| 56 | + |
| 57 | + path = "~some_unexisting_user/local-myrack" |
| 58 | + bundle :install, env: { "BUNDLE_LOCAL__MYRACK" => path }, raise_on_error: false |
| 59 | + expect(exitstatus).to eq(11) |
| 60 | + expect(err).to include("Cannot use local override", path, "bundle config unset local.myrack") |
| 61 | + end |
| 62 | + |
| 63 | + it "rejects an empty local override" do |
| 64 | + gemfile <<-G |
| 65 | + source "https://gem.repo1" |
| 66 | + gem "myrack", :git => "#{lib_path("myrack-0.8")}", :branch => "main" |
| 67 | + G |
| 68 | + |
| 69 | + bundle :install, env: { "BUNDLE_LOCAL__MYRACK" => "" }, raise_on_error: false |
| 70 | + expect(exitstatus).to eq(11) |
| 71 | + expect(err).to include("does not exist", "bundle config unset local.myrack") |
| 72 | + end |
| 73 | + |
22 | 74 | it "chooses the local repository on runtime" do |
23 | 75 | build_git "myrack", "0.8" |
24 | 76 |
|
|
0 commit comments