|
241 | 241 | expect(the_bundle).to include_gems("rack 1.2") |
242 | 242 | end |
243 | 243 |
|
244 | | - it "automatically updates lockfile to use the older version" do |
245 | | - build_repo2 do |
246 | | - build_gem "parallel_tests", "3.7.0" do |s| |
247 | | - s.required_ruby_version = ">= #{current_ruby_minor}" |
248 | | - end |
| 244 | + context "when there is a lockfile using the newer incompatible version" do |
| 245 | + before do |
| 246 | + build_repo2 do |
| 247 | + build_gem "parallel_tests", "3.7.0" do |s| |
| 248 | + s.required_ruby_version = ">= #{current_ruby_minor}" |
| 249 | + end |
249 | 250 |
|
250 | | - build_gem "parallel_tests", "3.8.0" do |s| |
251 | | - s.required_ruby_version = ">= #{next_ruby_minor}" |
| 251 | + build_gem "parallel_tests", "3.8.0" do |s| |
| 252 | + s.required_ruby_version = ">= #{next_ruby_minor}" |
| 253 | + end |
252 | 254 | end |
253 | | - end |
254 | 255 |
|
255 | | - gemfile <<-G |
256 | | - source "http://localgemserver.test/" |
257 | | - gem 'parallel_tests' |
258 | | - G |
| 256 | + gemfile <<-G |
| 257 | + source "http://localgemserver.test/" |
| 258 | + gem 'parallel_tests' |
| 259 | + G |
259 | 260 |
|
260 | | - lockfile <<~L |
261 | | - GEM |
262 | | - remote: http://localgemserver.test/ |
263 | | - specs: |
264 | | - parallel_tests (3.8.0) |
| 261 | + lockfile <<~L |
| 262 | + GEM |
| 263 | + remote: http://localgemserver.test/ |
| 264 | + specs: |
| 265 | + parallel_tests (3.8.0) |
265 | 266 |
|
266 | | - PLATFORMS |
267 | | - #{lockfile_platforms} |
| 267 | + PLATFORMS |
| 268 | + #{lockfile_platforms} |
268 | 269 |
|
269 | | - DEPENDENCIES |
270 | | - parallel_tests |
| 270 | + DEPENDENCIES |
| 271 | + parallel_tests |
271 | 272 |
|
272 | | - BUNDLED WITH |
273 | | - #{Bundler::VERSION} |
274 | | - L |
| 273 | + BUNDLED WITH |
| 274 | + #{Bundler::VERSION} |
| 275 | + L |
| 276 | + end |
275 | 277 |
|
276 | | - bundle "install --verbose", :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } |
| 278 | + it "automatically updates lockfile to use the older version" do |
| 279 | + bundle "install --verbose", :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } |
277 | 280 |
|
278 | | - expect(lockfile).to eq <<~L |
279 | | - GEM |
280 | | - remote: http://localgemserver.test/ |
281 | | - specs: |
282 | | - parallel_tests (3.7.0) |
| 281 | + expect(lockfile).to eq <<~L |
| 282 | + GEM |
| 283 | + remote: http://localgemserver.test/ |
| 284 | + specs: |
| 285 | + parallel_tests (3.7.0) |
283 | 286 |
|
284 | | - PLATFORMS |
285 | | - #{lockfile_platforms} |
| 287 | + PLATFORMS |
| 288 | + #{lockfile_platforms} |
286 | 289 |
|
287 | | - DEPENDENCIES |
288 | | - parallel_tests |
| 290 | + DEPENDENCIES |
| 291 | + parallel_tests |
289 | 292 |
|
290 | | - BUNDLED WITH |
291 | | - #{Bundler::VERSION} |
292 | | - L |
| 293 | + BUNDLED WITH |
| 294 | + #{Bundler::VERSION} |
| 295 | + L |
| 296 | + end |
| 297 | + |
| 298 | + it "gives a meaningful error if we're in frozen mode" do |
| 299 | + expect do |
| 300 | + bundle "install --verbose", :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s, "BUNDLE_FROZEN" => "true" }, :raise_on_error => false |
| 301 | + end.not_to change { lockfile } |
| 302 | + |
| 303 | + expect(err).to include("parallel_tests-3.8.0 requires ruby version >= #{next_ruby_minor}") |
| 304 | + expect(err).not_to include("That means the author of parallel_tests (3.8.0) has removed it.") |
| 305 | + end |
293 | 306 | end |
294 | 307 |
|
295 | 308 | it "gives a meaningful error on ruby version mismatches between dependencies" do |
|
0 commit comments