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: Use project fixture helpers in specs #3396

Merged
merged 1 commit into from
Mar 29, 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
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
options: { bundler_2_available: bundler_2_available? }
)
end
let(:dependency_files) { [gemfile, lockfile] }
let(:dependency_files) do
bundler_project_dependency_files("subdep_blocked_by_subdep")
end

let(:dependency) do
Dependabot::Dependency.new(
Expand All @@ -36,15 +38,6 @@
let(:current_version) { "1.0.1" }
let(:target_version) { "2.0.0" }

let(:gemfile) do
Dependabot::DependencyFile.new(content: gemfile_body, name: "Gemfile")
end
let(:lockfile) do
Dependabot::DependencyFile.new(content: lockfile_body, name: "Gemfile.lock")
end
let(:gemfile_body) { fixture("projects", "bundler1", "subdep_blocked_by_subdep", "Gemfile") }
let(:lockfile_body) { fixture("projects", "bundler1", "subdep_blocked_by_subdep", "Gemfile.lock") }

describe "#conflicting_dependencies" do
subject(:conflicting_dependencies) do
resolver.conflicting_dependencies(
Expand All @@ -68,6 +61,7 @@

context "with no blocking dependencies" do
let(:target_version) { "1.5.0" }

it "returns an empty array" do
expect(conflicting_dependencies).to match_array([])
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
options: { bundler_2_available: bundler_2_available? }
)
end
let(:dependency_files) { [gemfile, lockfile] }
let(:dependency_files) { bundler_project_dependency_files("gemfile") }

let(:dependency) do
Dependabot::Dependency.new(
Expand Down Expand Up @@ -55,21 +55,11 @@
}]
end

let(:gemfile) do
Dependabot::DependencyFile.new(content: gemfile_body, name: "Gemfile")
end
let(:lockfile) do
Dependabot::DependencyFile.new(content: lockfile_body, name: "Gemfile.lock")
end

describe "#updated_dependencies" do
subject(:updated_dependencies) { updater.updated_dependencies }

context "when updating the dependency that requires the other" do
let(:gemfile_body) { fixture("projects", "bundler1", "version_conflict", "Gemfile") }
let(:lockfile_body) do
fixture("projects", "bundler1", "version_conflict", "Gemfile.lock")
end
let(:dependency_files) { bundler_project_dependency_files("version_conflict") }
let(:target_version) { "3.6.0" }
let(:dependency_name) { "rspec-mocks" }
let(:requirements) do
Expand Down Expand Up @@ -114,10 +104,7 @@
end

context "when updating the dependency that is required by the other" do
let(:gemfile_body) { fixture("projects", "bundler1", "version_conflict", "Gemfile") }
let(:lockfile_body) do
fixture("projects", "bundler1", "version_conflict", "Gemfile.lock")
end
let(:dependency_files) { bundler_project_dependency_files("version_conflict") }
let(:target_version) { "3.6.0" }
let(:dependency_name) { "rspec-support" }
let(:requirements) do
Expand Down Expand Up @@ -162,10 +149,7 @@
end

context "when two dependencies require the same subdependency" do
let(:gemfile_body) { fixture("projects", "bundler1", "version_conflict_mutual_sub", "Gemfile") }
let(:lockfile_body) do
fixture("projects", "bundler1", "version_conflict_mutual_sub", "Gemfile.lock")
end
let(:dependency_files) { bundler_project_dependency_files("version_conflict_mutual_sub") }

let(:dependency_name) { "rspec-mocks" }
let(:target_version) { "3.6.0" }
Expand Down Expand Up @@ -211,10 +195,7 @@
end

context "when another dependency would need to be downgraded" do
let(:gemfile_body) { fixture("projects", "bundler1", "subdep_blocked_by_subdep", "Gemfile") }
let(:lockfile_body) do
fixture("projects", "bundler1", "subdep_blocked_by_subdep", "Gemfile.lock")
end
let(:dependency_files) { bundler_project_dependency_files("subdep_blocked_by_subdep") }
let(:target_version) { "2.0.0" }
let(:dependency_name) { "dummy-pkg-a" }

Expand All @@ -225,10 +206,7 @@
end

context "when the ruby version would need to change" do
let(:gemfile_body) { fixture("projects", "bundler1", "legacy_ruby", "Gemfile") }
let(:lockfile_body) do
fixture("projects", "bundler1", "legacy_ruby", "Gemfile.lock")
end
let(:dependency_files) { bundler_project_dependency_files("legacy_ruby") }
let(:target_version) { "2.0.5" }
let(:dependency_name) { "public_suffix" }

Expand Down