Skip to content

Commit

Permalink
Bundler 2: Add test for bundler dependency
Browse files Browse the repository at this point in the history
On v1, gems with a new version with a dependency on bundler 2 would fail to update,
this has since been fixed as demonstrated by this test.
  • Loading branch information
jurre committed Mar 30, 2021
1 parent e2b5670 commit 64655b1
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 0 deletions.
27 changes: 27 additions & 0 deletions bundler/spec/dependabot/bundler/file_updater_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1596,6 +1596,33 @@
end
end

context "for a gem that depends on bundler" do
subject(:updated_gemfile) do
updated_files.find { |f| f.name == "Gemfile" }
end

let(:dependency_files) { bundler_project_dependency_files("guard_bundler") }
let(:dependency_name) { "guard-bundler" }
let(:dependency_version) { "3.0.0" }
let(:dependency_previous_version) { "2.2.1" }
let(:requirements) do
[{
file: "Gemfile",
requirement: "~> 2.2.1",
groups: [],
source: nil
}]
end

it "raises an error", :bundler_v1_only do
expect { updated_gemfile }.to raise_error(/Bundler could not find compatible versions for gem "bundler"/)
end

it "returns the latest version", :bundler_v2_only do
expect(updated_gemfile.content).to include("\"guard-bundler\", \"~> 2.2.1\"")
end
end

context "vendoring" do
let(:project_name) { "vendored_gems" }
let(:repo_contents_path) { build_tmp_repo(project_name) }
Expand Down
5 changes: 5 additions & 0 deletions bundler/spec/fixtures/projects/bundler1/guard_bundler/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

source "https://rubygems.org"

gem "guard-bundler", "~> 2.2.1"
46 changes: 46 additions & 0 deletions bundler/spec/fixtures/projects/bundler1/guard_bundler/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
GEM
remote: https://rubygems.org/
specs:
coderay (1.1.3)
ffi (1.14.2)
formatador (0.2.5)
guard (2.16.2)
formatador (>= 0.2.4)
listen (>= 2.7, < 4.0)
lumberjack (>= 1.0.12, < 2.0)
nenv (~> 0.1)
notiffany (~> 0.0)
pry (>= 0.9.12)
shellany (~> 0.0)
thor (>= 0.18.1)
guard-bundler (2.2.1)
bundler (>= 1.3.0, < 3)
guard (~> 2.2)
guard-compat (~> 1.1)
guard-compat (1.2.1)
listen (3.4.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
lumberjack (1.2.8)
method_source (1.0.0)
nenv (0.3.0)
notiffany (0.1.3)
nenv (~> 0.1)
shellany (~> 0.0)
pry (0.14.0)
coderay (~> 1.1)
method_source (~> 1.0)
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
shellany (0.0.1)
thor (1.1.0)

PLATFORMS
ruby

DEPENDENCIES
guard-bundler (= 2.2.1)

BUNDLED WITH
2.1.4

0 comments on commit 64655b1

Please sign in to comment.