dependabot-bundler 0.279.0 → 0.281.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/lib/dependabot/bundler/helpers.rb +1 -13
  3. data/lib/dependabot/bundler/package_manager.rb +6 -6
  4. data/lib/dependabot/bundler/update_checker/shared_bundler_helpers.rb +1 -2
  5. metadata +7 -32
  6. data/helpers/v1/.gitignore +0 -8
  7. data/helpers/v1/Gemfile +0 -7
  8. data/helpers/v1/build +0 -29
  9. data/helpers/v1/lib/functions/conflicting_dependency_resolver.rb +0 -89
  10. data/helpers/v1/lib/functions/dependency_source.rb +0 -90
  11. data/helpers/v1/lib/functions/file_parser.rb +0 -119
  12. data/helpers/v1/lib/functions/force_updater.rb +0 -173
  13. data/helpers/v1/lib/functions/lockfile_updater.rb +0 -218
  14. data/helpers/v1/lib/functions/version_resolver.rb +0 -141
  15. data/helpers/v1/lib/functions.rb +0 -172
  16. data/helpers/v1/monkey_patches/definition_bundler_version_patch.rb +0 -16
  17. data/helpers/v1/monkey_patches/definition_ruby_version_patch.rb +0 -22
  18. data/helpers/v1/monkey_patches/fileutils_keyword_splat_patch.rb +0 -20
  19. data/helpers/v1/monkey_patches/git_source_patch.rb +0 -62
  20. data/helpers/v1/monkey_patches/object_untaint_patch.rb +0 -17
  21. data/helpers/v1/monkey_patches/resolver_spec_group_sane_eql.rb +0 -18
  22. data/helpers/v1/patched_bundler +0 -34
  23. data/helpers/v1/run.rb +0 -38
  24. data/helpers/v1/spec/functions/conflicting_dependency_resolver_spec.rb +0 -118
  25. data/helpers/v1/spec/functions/dependency_source_spec.rb +0 -188
  26. data/helpers/v1/spec/functions/file_parser_spec.rb +0 -75
  27. data/helpers/v1/spec/functions/force_updater_spec.rb +0 -59
  28. data/helpers/v1/spec/functions/version_resolver_spec.rb +0 -105
  29. data/helpers/v1/spec/native_spec_helper.rb +0 -56
  30. data/helpers/v1/spec/shared_contexts.rb +0 -60
@@ -1,34 +0,0 @@
1
- #!/usr/local/bin/ruby
2
- #
3
- # This file was generated by RubyGems.
4
- # It was then patched by Dependabot to add `Object#untaint` back
5
- # in order to run bundler 1.17.3 using Ruby 3.3+.
6
- #
7
- # The application 'bundler' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- $LOAD_PATH.unshift(File.expand_path("./monkey_patches", __dir__))
12
- require "object_untaint_patch"
13
-
14
- require 'rubygems'
15
-
16
- version = ">= 0.a"
17
-
18
- str = ARGV.first
19
- if str
20
- str = str.b[/\A_(.*)_\z/, 1]
21
- if str and Gem::Version.correct?(str)
22
- version = str
23
- ENV['BUNDLER_VERSION'] = str
24
-
25
- ARGV.shift
26
- end
27
- end
28
-
29
- if Gem.respond_to?(:activate_bin_path)
30
- load Gem.activate_bin_path('bundler', 'bundle', version)
31
- else
32
- gem "bundler", version
33
- load Gem.bin_path("bundler", "bundle", version)
34
- end
data/helpers/v1/run.rb DELETED
@@ -1,38 +0,0 @@
1
- # typed: strict
2
- # frozen_string_literal: true
3
-
4
- gem "bundler", "~> 1.17"
5
- require "bundler"
6
- require "json"
7
-
8
- $LOAD_PATH.unshift(File.expand_path("./lib", __dir__))
9
- $LOAD_PATH.unshift(File.expand_path("./monkey_patches", __dir__))
10
-
11
- trap "HUP" do
12
- puts JSON.generate(error: "timeout", error_class: "Timeout::Error", trace: [])
13
- exit 2
14
- end
15
-
16
- # Bundler monkey patches
17
- require "definition_ruby_version_patch"
18
- require "definition_bundler_version_patch"
19
- require "fileutils_keyword_splat_patch"
20
- require "git_source_patch"
21
- require "resolver_spec_group_sane_eql"
22
- require "object_untaint_patch"
23
-
24
- require "functions"
25
-
26
- begin
27
- request = JSON.parse($stdin.read)
28
-
29
- function = request["function"]
30
- args = request["args"].transform_keys(&:to_sym)
31
-
32
- print JSON.dump({ result: Functions.send(function, **args) })
33
- rescue StandardError => e
34
- print JSON.dump(
35
- { error: e.message, error_class: e.class, trace: e.backtrace }
36
- )
37
- exit(1)
38
- end
@@ -1,118 +0,0 @@
1
- # typed: false
2
- # frozen_string_literal: true
3
-
4
- require "native_spec_helper"
5
- require "shared_contexts"
6
-
7
- RSpec.describe Functions::ConflictingDependencyResolver do
8
- include_context "when in a temporary bundler directory"
9
-
10
- let(:conflicting_dependency_resolver) do
11
- described_class.new(
12
- dependency_name: dependency_name,
13
- target_version: target_version,
14
- lockfile_name: "Gemfile.lock"
15
- )
16
- end
17
-
18
- let(:dependency_name) { "dummy-pkg-a" }
19
- let(:target_version) { "2.0.0" }
20
-
21
- let(:project_name) { "blocked_by_subdep" }
22
-
23
- describe "#conflicting_dependencies" do
24
- subject(:conflicting_dependencies) do
25
- in_tmp_folder { conflicting_dependency_resolver.conflicting_dependencies }
26
- end
27
-
28
- it "returns a list of dependencies that block the update" do
29
- expect(conflicting_dependencies).to eq(
30
- [{
31
- "explanation" => "dummy-pkg-b (1.0.0) requires dummy-pkg-a (< 2.0.0)",
32
- "name" => "dummy-pkg-b",
33
- "version" => "1.0.0",
34
- "requirement" => "< 2.0.0"
35
- }]
36
- )
37
- end
38
-
39
- context "when dealing with nested transitive dependencies" do
40
- let(:project_name) { "transitive_blocking" }
41
- let(:dependency_name) { "activesupport" }
42
- let(:target_version) { "6.0.0" }
43
-
44
- it "returns a list of dependencies that block the update" do
45
- expect(conflicting_dependencies).to contain_exactly({
46
- "explanation" => "rails (5.2.0) requires activesupport (= 5.2.0)",
47
- "name" => "rails",
48
- "requirement" => "= 5.2.0",
49
- "version" => "5.2.0"
50
- }, {
51
- "explanation" => "rails (5.2.0) requires activesupport (= 5.2.0) via actionpack (5.2.0)",
52
- "name" => "actionpack",
53
- "version" => "5.2.0",
54
- "requirement" => "= 5.2.0"
55
- }, {
56
- "explanation" => "rails (5.2.0) requires activesupport (= 5.2.0) via actionview (5.2.0)",
57
- "name" => "actionview",
58
- "version" => "5.2.0",
59
- "requirement" => "= 5.2.0"
60
- }, {
61
- "explanation" => "rails (5.2.0) requires activesupport (= 5.2.0) via activejob (5.2.0)",
62
- "name" => "activejob",
63
- "version" => "5.2.0",
64
- "requirement" => "= 5.2.0"
65
- }, {
66
- "explanation" => "rails (5.2.0) requires activesupport (= 5.2.0) via activemodel (5.2.0)",
67
- "name" => "activemodel",
68
- "version" => "5.2.0",
69
- "requirement" => "= 5.2.0"
70
- }, {
71
- "explanation" => "rails (5.2.0) requires activesupport (= 5.2.0) via activerecord (5.2.0)",
72
- "name" => "activerecord",
73
- "version" => "5.2.0",
74
- "requirement" => "= 5.2.0"
75
- }, {
76
- "explanation" => "rails (5.2.0) requires activesupport (= 5.2.0) via railties (5.2.0)",
77
- "name" => "railties",
78
- "version" => "5.2.0",
79
- "requirement" => "= 5.2.0"
80
- })
81
- end
82
- end
83
-
84
- context "with multiple blocking dependencies" do
85
- let(:dependency_name) { "activesupport" }
86
- let(:current_version) { "5.0.0" }
87
- let(:target_version) { "6.0.0" }
88
- let(:project_name) { "multiple_blocking" }
89
-
90
- it "returns all of the blocking dependencies" do
91
- expect(conflicting_dependencies).to contain_exactly({
92
- "explanation" => "actionmailer (5.0.0) requires activesupport (= 5.0.0) via actionpack (5.0.0)",
93
- "name" => "actionpack",
94
- "version" => "5.0.0",
95
- "requirement" => "= 5.0.0"
96
- }, {
97
- "explanation" => "actionview (5.0.0) requires activesupport (= 5.0.0)",
98
- "name" => "actionview",
99
- "version" => "5.0.0",
100
- "requirement" => "= 5.0.0"
101
- }, {
102
- "explanation" => "actionmailer (5.0.0) requires activesupport (= 5.0.0) via activejob (5.0.0)",
103
- "name" => "activejob",
104
- "version" => "5.0.0",
105
- "requirement" => "= 5.0.0"
106
- })
107
- end
108
- end
109
-
110
- context "without any blocking dependencies" do
111
- let(:target_version) { "1.0.0" }
112
-
113
- it "returns an empty list" do
114
- expect(conflicting_dependencies).to eq([])
115
- end
116
- end
117
- end
118
- end
@@ -1,188 +0,0 @@
1
- # typed: false
2
- # frozen_string_literal: true
3
-
4
- require "native_spec_helper"
5
- require "shared_contexts"
6
-
7
- RSpec.describe Functions::DependencySource do
8
- include_context "when in a temporary bundler directory"
9
-
10
- let(:dependency_source) do
11
- described_class.new(
12
- gemfile_name: "Gemfile",
13
- dependency_name: dependency_name
14
- )
15
- end
16
-
17
- let(:dependency_name) { "business" }
18
-
19
- let(:project_name) { "specified_source_no_lockfile" }
20
- let(:registry_url) { "https://repo.fury.io/greysteil/" }
21
- let(:gemfury_business_url) do
22
- "https://repo.fury.io/greysteil/api/v1/dependencies?gems=business"
23
- end
24
-
25
- before do
26
- stub_request(:get, registry_url + "versions")
27
- .with(basic_auth: ["SECRET_CODES", ""])
28
- .to_return(status: 404)
29
- stub_request(:get, registry_url + "api/v1/dependencies")
30
- .with(basic_auth: ["SECRET_CODES", ""])
31
- .to_return(status: 200)
32
- stub_request(:get, gemfury_business_url)
33
- .with(basic_auth: ["SECRET_CODES", ""])
34
- .to_return(status: 200, body: fixture("ruby", "gemfury_response"))
35
- end
36
-
37
- describe "#private_registry_versions" do
38
- subject(:private_registry_versions) do
39
- in_tmp_folder { dependency_source.private_registry_versions }
40
- end
41
-
42
- it "returns all versions from the private source" do
43
- expect(private_registry_versions).to eq([
44
- Gem::Version.new("1.5.0"),
45
- Gem::Version.new("1.9.0"),
46
- Gem::Version.new("1.10.0.beta")
47
- ])
48
- end
49
-
50
- context "when specified as the default source" do
51
- let(:project_name) { "specified_default_source_no_lockfile" }
52
-
53
- it "returns all versions from the private source" do
54
- expect(private_registry_versions).to eq([
55
- Gem::Version.new("1.5.0"),
56
- Gem::Version.new("1.9.0"),
57
- Gem::Version.new("1.10.0.beta")
58
- ])
59
- end
60
- end
61
-
62
- context "when we don't have authentication details for" do
63
- before do
64
- stub_request(:get, registry_url + "versions")
65
- .with(basic_auth: ["SECRET_CODES", ""])
66
- .to_return(status: 401)
67
- stub_request(:get, registry_url + "api/v1/dependencies")
68
- .with(basic_auth: ["SECRET_CODES", ""])
69
- .to_return(status: 401)
70
- stub_request(:get, registry_url + "specs.4.8.gz")
71
- .with(basic_auth: ["SECRET_CODES", ""])
72
- .to_return(status: 401)
73
- end
74
-
75
- it "blows up with a useful error" do
76
- error_class = Bundler::Fetcher::AuthenticationRequiredError
77
- error_message = "Authentication is required for repo.fury.io"
78
- expect { private_registry_versions }
79
- .to raise_error do |error|
80
- expect(error).to be_a(error_class)
81
- expect(error.message).to include(error_message)
82
- end
83
- end
84
- end
85
-
86
- context "when we have bad authentication details" do
87
- before do
88
- stub_request(:get, registry_url + "versions")
89
- .with(basic_auth: ["SECRET_CODES", ""])
90
- .to_return(status: 403)
91
- stub_request(:get, registry_url + "api/v1/dependencies")
92
- .with(basic_auth: ["SECRET_CODES", ""])
93
- .to_return(status: 403)
94
- stub_request(:get, registry_url + "specs.4.8.gz")
95
- .with(basic_auth: ["SECRET_CODES", ""])
96
- .to_return(status: 403)
97
- end
98
-
99
- it "blows up with a useful error" do
100
- error_class = Bundler::Fetcher::BadAuthenticationError
101
- expect { private_registry_versions }
102
- .to raise_error do |error|
103
- expect(error).to be_a(error_class)
104
- expect(error.message)
105
- .to include("Bad username or password for")
106
- end
107
- end
108
- end
109
-
110
- context "when bad-requested, but is a private repo" do
111
- before do
112
- stub_request(:get, registry_url + "versions")
113
- .with(basic_auth: ["SECRET_CODES", ""])
114
- .to_return(status: 400)
115
- stub_request(:get, registry_url + "api/v1/dependencies")
116
- .with(basic_auth: ["SECRET_CODES", ""])
117
- .to_return(status: 400)
118
- stub_request(:get, registry_url + "specs.4.8.gz")
119
- .with(basic_auth: ["SECRET_CODES", ""])
120
- .to_return(status: 400)
121
- end
122
-
123
- it "blows up with a useful error" do
124
- expect { private_registry_versions }
125
- .to raise_error do |error|
126
- expect(error).to be_a(Bundler::HTTPError)
127
- expect(error.message)
128
- .to include("Could not fetch specs from")
129
- end
130
- end
131
- end
132
-
133
- context "when it doesn't have details of the gem" do
134
- before do
135
- stub_request(:get, gemfury_business_url)
136
- .with(basic_auth: ["SECRET_CODES", ""])
137
- .to_return(status: 404)
138
-
139
- # Stub indexes to return details of other gems (but not this one)
140
- stub_request(:get, registry_url + "specs.4.8.gz")
141
- .to_return(
142
- status: 200,
143
- body: fixture("ruby", "contribsys_old_index_response")
144
- )
145
- stub_request(:get, registry_url + "prerelease_specs.4.8.gz")
146
- .to_return(
147
- status: 200,
148
- body: fixture("ruby", "contribsys_old_index_prerelease_response")
149
- )
150
- end
151
-
152
- it { is_expected.to be_empty }
153
- end
154
-
155
- context "when it only implements the old Bundler index format" do
156
- let(:project_name) { "sidekiq_pro" }
157
- let(:dependency_name) { "sidekiq-pro" }
158
- let(:registry_url) { "https://gems.contribsys.com/" }
159
-
160
- before do
161
- stub_request(:get, registry_url + "versions")
162
- .with(basic_auth: %w(username password))
163
- .to_return(status: 404)
164
- stub_request(:get, registry_url + "api/v1/dependencies")
165
- .with(basic_auth: %w(username password))
166
- .to_return(status: 404)
167
- stub_request(:get, registry_url + "specs.4.8.gz")
168
- .with(basic_auth: %w(username password))
169
- .to_return(
170
- status: 200,
171
- body: fixture("ruby", "contribsys_old_index_response")
172
- )
173
- stub_request(:get, registry_url + "prerelease_specs.4.8.gz")
174
- .with(basic_auth: %w(username password))
175
- .to_return(
176
- status: 200,
177
- body: fixture("ruby", "contribsys_old_index_prerelease_response")
178
- )
179
- end
180
-
181
- it "returns all versions from the private source" do
182
- expect(private_registry_versions.length).to be(70)
183
- expect(private_registry_versions.min).to eql(Gem::Version.new("1.0.0"))
184
- expect(private_registry_versions.max).to eql(Gem::Version.new("3.5.2"))
185
- end
186
- end
187
- end
188
- end
@@ -1,75 +0,0 @@
1
- # typed: false
2
- # frozen_string_literal: true
3
-
4
- require "native_spec_helper"
5
- require "shared_contexts"
6
-
7
- RSpec.describe Functions::FileParser do
8
- include_context "when in a temporary bundler directory"
9
-
10
- let(:dependency_source) do
11
- described_class.new(
12
- lockfile_name: "Gemfile.lock"
13
- )
14
- end
15
-
16
- describe "#parsed_gemfile" do
17
- subject(:parsed_gemfile) do
18
- in_tmp_folder do
19
- dependency_source.parsed_gemfile(gemfile_name: "Gemfile")
20
- end
21
- end
22
-
23
- let(:project_name) { "gemfile" }
24
-
25
- it "parses gemfile" do
26
- parsed_gemfile = [
27
- {
28
- groups: [:default],
29
- name: "business",
30
- requirement: Gem::Requirement.new("~> 1.4.0"),
31
- source: nil,
32
- type: :runtime
33
- },
34
- {
35
- groups: [:default],
36
- name: "statesman",
37
- requirement: Gem::Requirement.new("~> 1.2.0"),
38
- source: nil,
39
- type: :runtime
40
- }
41
- ]
42
- expect(parsed_gemfile).not_to be_nil # to get past IdenticalEqualityAssertion
43
- end
44
- end
45
-
46
- describe "#parsed_gemspec" do
47
- subject(:parsed_gemspec) do
48
- in_tmp_folder do |_tmp_path|
49
- dependency_source.parsed_gemspec(gemspec_name: "example.gemspec")
50
- end
51
- end
52
-
53
- let(:project_name) { "gemfile_exact" }
54
-
55
- it "parses gemspec" do
56
- parsed_gemspec = [
57
- {
58
- groups: nil,
59
- name: "business",
60
- requirement: Gem::Requirement.new("= 1.0.0"),
61
- source: nil,
62
- type: :runtime
63
- },
64
- {
65
- groups: nil,
66
- name: "statesman",
67
- requirement: Gem::Requirement.new("= 1.0.0"),
68
- source: nil,
69
- type: :runtime
70
- }
71
- ]
72
- expect(parsed_gemspec).not_to be_nil # to get past IdenticalEqualityAssertion
73
- end
74
- end
75
- end
@@ -1,59 +0,0 @@
1
- # typed: false
2
- # frozen_string_literal: true
3
-
4
- require "native_spec_helper"
5
- require "shared_contexts"
6
-
7
- RSpec.describe Functions::ForceUpdater do
8
- include_context "when in a temporary bundler directory"
9
- include_context "when stubbing rubygems compact index"
10
-
11
- let(:force_updater) do
12
- described_class.new(
13
- dependency_name: dependency_name,
14
- target_version: target_version,
15
- gemfile_name: gemfile_name,
16
- lockfile_name: lockfile_name,
17
- update_multiple_dependencies: update_multiple_dependencies
18
- )
19
- end
20
- let(:gemfile_name) { "Gemfile" }
21
- let(:lockfile_name) { "Gemfile.lock" }
22
- let(:update_multiple_dependencies) { true }
23
-
24
- describe "#run" do
25
- subject(:force_update) do
26
- in_tmp_folder { force_updater.run }
27
- end
28
-
29
- context "with a version conflict" do
30
- let(:target_version) { "3.6.0" }
31
- let(:dependency_name) { "rspec-support" }
32
- let(:project_name) { "version_conflict" }
33
-
34
- it "updates the conflicting dependencies" do
35
- updated_deps, _specs = force_update
36
- expect(updated_deps).to eq([{ name: "rspec-support" }, { name: "rspec-mocks" }])
37
- end
38
-
39
- context "when updating a single dependency" do
40
- let(:update_multiple_dependencies) { false }
41
-
42
- it { expect { force_update }.to raise_error(Bundler::VersionConflict) }
43
- end
44
- end
45
-
46
- context "with a version conflict in gems rb" do
47
- let(:target_version) { "3.6.0" }
48
- let(:dependency_name) { "rspec-support" }
49
- let(:project_name) { "version_conflict_gems_rb" }
50
- let(:gemfile_name) { "gems.rb" }
51
- let(:lockfile_name) { "gems.locked" }
52
-
53
- it "updates the conflicting dependencies" do
54
- updated_deps, _specs = force_update
55
- expect(updated_deps).to eq([{ name: "rspec-support" }, { name: "rspec-mocks" }])
56
- end
57
- end
58
- end
59
- end
@@ -1,105 +0,0 @@
1
- # typed: false
2
- # frozen_string_literal: true
3
-
4
- require "native_spec_helper"
5
- require "shared_contexts"
6
-
7
- RSpec.describe Functions::VersionResolver do
8
- include_context "when in a temporary bundler directory"
9
- include_context "when stubbing rubygems compact index"
10
-
11
- let(:version_resolver) do
12
- described_class.new(
13
- dependency_name: dependency_name,
14
- dependency_requirements: dependency_requirements,
15
- gemfile_name: "Gemfile",
16
- lockfile_name: "Gemfile.lock"
17
- )
18
- end
19
-
20
- let(:dependency_name) { "business" }
21
- let(:dependency_requirements) do
22
- [{
23
- file: "Gemfile",
24
- requirement: requirement_string,
25
- groups: [],
26
- source: source
27
- }]
28
- end
29
- let(:source) { nil }
30
-
31
- let(:rubygems_url) { "https://index.rubygems.org/api/v1/" }
32
- let(:old_index_url) { rubygems_url + "dependencies" }
33
-
34
- describe "#version_details" do
35
- subject do
36
- in_tmp_folder { version_resolver.version_details }
37
- end
38
-
39
- let(:project_name) { "gemfile" }
40
- let(:requirement_string) { " >= 0" }
41
-
42
- its([:version]) { is_expected.to eq(Gem::Version.new("1.4.0")) }
43
- its([:fetcher]) { is_expected.to eq("Bundler::Fetcher::CompactIndex") }
44
-
45
- context "with a private gemserver source" do
46
- include_context "when stubbing rubygems compact index"
47
-
48
- let(:project_name) { "specified_source" }
49
- let(:requirement_string) { ">= 0" }
50
-
51
- before do
52
- gemfury_url = "https://repo.fury.io/greysteil/"
53
- gemfury_deps_url = gemfury_url + "api/v1/dependencies"
54
-
55
- stub_request(:get, gemfury_url + "versions")
56
- .to_return(status: 200, body: fixture("ruby", "gemfury-index"))
57
- stub_request(:get, gemfury_url + "info/business").to_return(status: 404)
58
- stub_request(:get, gemfury_deps_url).to_return(status: 200)
59
- stub_request(:get, gemfury_deps_url + "?gems=business,statesman")
60
- .to_return(status: 200, body: fixture("ruby", "gemfury_response"))
61
- stub_request(:get, gemfury_deps_url + "?gems=business")
62
- .to_return(status: 200, body: fixture("ruby", "gemfury_response"))
63
- stub_request(:get, gemfury_deps_url + "?gems=statesman")
64
- .to_return(status: 200, body: fixture("ruby", "gemfury_response"))
65
- end
66
-
67
- its([:version]) { is_expected.to eq(Gem::Version.new("1.9.0")) }
68
- its([:fetcher]) { is_expected.to eq("Bundler::Fetcher::Dependency") }
69
- end
70
-
71
- context "with a git source" do
72
- let(:project_name) { "git_source" }
73
-
74
- its([:version]) { is_expected.to eq(Gem::Version.new("1.6.0")) }
75
- its([:fetcher]) { is_expected.to be_nil }
76
- end
77
-
78
- context "when Bundler's compact index is down" do
79
- before do
80
- stub_request(:get, "https://index.rubygems.org/versions")
81
- .to_return(status: 500, body: "We'll be back soon")
82
- stub_request(:get, "https://index.rubygems.org/info/public_suffix")
83
- .to_return(status: 500, body: "We'll be back soon")
84
- stub_request(:get, old_index_url).to_return(status: 200)
85
- stub_request(:get, old_index_url + "?gems=business,statesman")
86
- .to_return(
87
- status: 200,
88
- body: fixture("rubygems_responses",
89
- "dependencies-default-gemfile")
90
- )
91
- end
92
-
93
- its([:version]) { is_expected.to eq(Gem::Version.new("1.4.0")) }
94
- its([:fetcher]) { is_expected.to eq("Bundler::Fetcher::Dependency") }
95
- end
96
-
97
- context "with no update possible due to a version conflict" do
98
- let(:project_name) { "version_conflict_with_listed_subdep" }
99
- let(:dependency_name) { "rspec-mocks" }
100
- let(:requirement_string) { ">= 0" }
101
-
102
- its([:version]) { is_expected.to eq(Gem::Version.new("3.6.0")) }
103
- end
104
- end
105
- end
@@ -1,56 +0,0 @@
1
- # typed: false
2
- # frozen_string_literal: true
3
-
4
- require "rspec/its"
5
- require "webmock/rspec"
6
- require "tmpdir"
7
-
8
- $LOAD_PATH.unshift(File.expand_path("../lib", __dir__))
9
- $LOAD_PATH.unshift(File.expand_path("../monkey_patches", __dir__))
10
- $LOAD_PATH.unshift(File.expand_path("../../spec_helpers", __dir__))
11
-
12
- # Bundler monkey patches
13
- require "definition_ruby_version_patch"
14
- require "definition_bundler_version_patch"
15
- require "fileutils_keyword_splat_patch"
16
- require "git_source_patch"
17
- require "resolver_spec_group_sane_eql"
18
-
19
- require "functions"
20
-
21
- require "gem_net_http_adapter"
22
-
23
- RSpec.configure do |config|
24
- config.color = true
25
- config.order = :rand
26
- config.mock_with(:rspec) { |mocks| mocks.verify_partial_doubles = true }
27
- config.raise_errors_for_deprecations!
28
- end
29
-
30
- # Duplicated in lib/dependabot/bundler/file_updater/lockfile_updater.rb
31
- # TODO: Stop sanitizing the lockfile once we have bundler 2 installed
32
- LOCKFILE_ENDING = /(?<ending>\s*(?:RUBY VERSION|BUNDLED WITH).*)/m
33
-
34
- def project_dependency_files(project)
35
- project_path = File.expand_path(File.join("../../spec/fixtures/projects/bundler1", project))
36
-
37
- raise "Fixture does not exist for project: '#{project}'" unless Dir.exist?(project_path)
38
-
39
- Dir.chdir(project_path) do
40
- # NOTE: Include dotfiles (e.g. .npmrc)
41
- files = Dir.glob("**/*", File::FNM_DOTMATCH)
42
- files = files.select { |f| File.file?(f) }
43
- files.map do |filename|
44
- content = File.read(filename)
45
- content = content.gsub(LOCKFILE_ENDING, "") if filename == "Gemfile.lock"
46
- {
47
- name: filename,
48
- content: content
49
- }
50
- end
51
- end
52
- end
53
-
54
- def fixture(*name)
55
- File.read(File.join("../../spec/fixtures", File.join(*name)))
56
- end