|
2 | 2 |
|
3 | 3 | RSpec.describe "bundle install with git sources" do |
4 | 4 | describe "when floating on main" do |
5 | | - before :each do |
| 5 | + let(:install_base_gemfile) do |
6 | 6 | build_git "foo" do |s| |
7 | 7 | s.executables = "foobar" |
8 | 8 | end |
|
16 | 16 | end |
17 | 17 |
|
18 | 18 | it "fetches gems" do |
| 19 | + install_base_gemfile |
19 | 20 | expect(the_bundle).to include_gems("foo 1.0") |
20 | 21 |
|
21 | 22 | run <<-RUBY |
|
27 | 28 | end |
28 | 29 |
|
29 | 30 | it "caches the git repo" do |
| 31 | + install_base_gemfile |
30 | 32 | expect(Dir["#{default_bundle_path}/cache/bundler/git/foo-1.0-*"]).to have_attributes size: 1 |
31 | 33 | end |
32 | 34 |
|
33 | 35 | it "does not write to cache on bundler/setup" do |
| 36 | + install_base_gemfile |
34 | 37 | FileUtils.rm_r(default_cache_path) |
35 | 38 | ruby "require 'bundler/setup'" |
36 | 39 | expect(default_cache_path).not_to exist |
37 | 40 | end |
38 | 41 |
|
39 | 42 | it "caches the git repo globally and properly uses the cached repo on the next invocation" do |
| 43 | + install_base_gemfile |
40 | 44 | pristine_system_gems |
41 | 45 | bundle "config set global_gem_cache true" |
42 | 46 | bundle :install |
|
48 | 52 | end |
49 | 53 |
|
50 | 54 | it "caches the evaluated gemspec" do |
| 55 | + install_base_gemfile |
51 | 56 | git = update_git "foo" do |s| |
52 | 57 | s.executables = ["foobar"] # we added this the first time, so keep it now |
53 | 58 | s.files = ["bin/foobar"] # updating git nukes the files list |
|
66 | 71 | end |
67 | 72 |
|
68 | 73 | it "does not update the git source implicitly" do |
| 74 | + install_base_gemfile |
69 | 75 | update_git "foo" |
70 | 76 |
|
71 | 77 | install_gemfile bundled_app2("Gemfile"), <<-G, dir: bundled_app2 |
|
84 | 90 | end |
85 | 91 |
|
86 | 92 | it "sets up git gem executables on the path" do |
| 93 | + install_base_gemfile |
87 | 94 | bundle "exec foobar" |
88 | 95 | expect(out).to eq("1.0") |
89 | 96 | end |
|
136 | 143 |
|
137 | 144 | it "still works after moving the application directory" do |
138 | 145 | bundle "config set --local path vendor/bundle" |
139 | | - bundle "install" |
| 146 | + install_base_gemfile |
140 | 147 |
|
141 | 148 | FileUtils.mv bundled_app, tmp("bundled_app.bck") |
142 | 149 |
|
|
145 | 152 |
|
146 | 153 | it "can still install after moving the application directory" do |
147 | 154 | bundle "config set --local path vendor/bundle" |
148 | | - bundle "install" |
| 155 | + install_base_gemfile |
149 | 156 |
|
150 | 157 | FileUtils.mv bundled_app, tmp("bundled_app.bck") |
151 | 158 |
|
|
0 commit comments