Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
feelepxyz committed Apr 20, 2021
1 parent 5557fc3 commit 0c7a1be
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 1 deletion.
5 changes: 5 additions & 0 deletions docker/spec/dependabot/docker/update_checker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,11 @@
it { is_expected.to eq("17.04") }
end

context "when ignoring multiple versions" do
let(:ignored_versions) { [">= 17.10, < 17.2"] }
it { is_expected.to eq("17.10") }
end

context "when all versions are being ignored" do
let(:ignored_versions) { [">= 0"] }
it { is_expected.to eq("17.04") }
Expand Down
5 changes: 5 additions & 0 deletions elm/spec/dependabot/elm/update_checker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,11 @@
it { is_expected.to eq(Dependabot::Elm::Version.new("4.0.5")) }
end

context "when ignoring several versions" do
let(:ignored_versions) { [">= 5.0.0, < 5.1.0"] }
it { is_expected.to eq(Dependabot::Elm::Version.new("5.1.1")) }
end

context "when all versions are being ignored" do
let(:ignored_versions) { [">= 0"] }
it "returns nil" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@
its([:version]) { is_expected.to eq(version_class.new("22.0")) }
end

context "when the user has asked to ignore several major versions" do
let(:ignored_versions) { ["[23.0,24),[22.0,23)"] }
let(:dependency_version) { "17.0" }
its([:version]) { is_expected.to eq(version_class.new("21.0")) }
end

context "when a version range is specified using Ruby syntax" do
let(:ignored_versions) { [">= 23.0, < 24"] }
let(:dependency_version) { "17.0" }
Expand Down
13 changes: 13 additions & 0 deletions maven/spec/dependabot/maven/update_checker/version_finder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,19 @@
its([:version]) { is_expected.to eq(version_class.new("22.0")) }
end

context "when the user has asked to ignore several major versions" do
let(:ignored_versions) { ["[23.0,24),[22.0,23)"] }
let(:dependency_version) { "17.0" }
let(:maven_central_version_files_url) do
"https://repo.maven.apache.org/maven2/"\
"com/google/guava/guava/21.0/guava-21.0.jar"
end
let(:maven_central_version_files) do
fixture("maven_central_version_files", "guava-22.0.html")
end
its([:version]) { is_expected.to eq(version_class.new("21.0")) }
end

context "when a version range is specified using Ruby syntax" do
let(:ignored_versions) { [">= 23.0, < 24"] }
let(:dependency_version) { "17.0" }
Expand Down
9 changes: 8 additions & 1 deletion terraform/spec/dependabot/terraform/update_checker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
described_class.new(
dependency: dependency,
dependency_files: [],
credentials: credentials
credentials: credentials,
ignored_versions: ignored_versions
)
end
let(:credentials) do
Expand All @@ -24,6 +25,7 @@
"password" => "token"
}]
end
let(:ignored_versions) { [] }

let(:dependency) do
Dependabot::Dependency.new(
Expand Down Expand Up @@ -99,6 +101,11 @@

it { is_expected.to eq(Gem::Version.new("0.3.8")) }

context "when the user is ignoring the latest version" do
let(:ignored_versions) { [">= 0.3.8, < 0.4.0"] }
it { is_expected.to eq(Gem::Version.new("0.3.7")) }
end

context "for a custom registry" do
let(:source) do
{
Expand Down

0 comments on commit 0c7a1be

Please sign in to comment.