Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bundler 2: Add test for bundler dependency #3408

Merged
merged 1 commit into from
Mar 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -1443,6 +1443,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
Copy link
Member Author

@jurre jurre Mar 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there's a way to trigger this error anymore, it'll just not propose an update I think (the update checker would return 2.2.1 for this case)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, test in the updater checker instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was my thought as well, but turns out the UpdateChecker isn't currently smart enough, demonstrated here: #3418

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(:dependency_files) { bundler_project_dependency_files(project_name) }
Expand Down
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"
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
1.7.3
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"
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