Skip to content

Commit

Permalink
TICtxtWrd-hex: Test Improvements, Context Wording, ecosystem hex. (#9868
Browse files Browse the repository at this point in the history
)

* TICtxtWrd-hex: Test Improvements, Context Wording, ecosystem hex.

* TICtxtWrd-hex: Test Improvements, Context Wording, ecosystem hex.

* TICtxtWrd-hex: Token updated.

* TICtxtWrd-hex: Skipping the failing test

* TICtxtWrd-hex: Lint error fixes.

---------

Co-authored-by: “Thavachelvam <“thavaahariharangit@git.com”>
  • Loading branch information
thavaahariharangit and “Thavachelvam authored Jun 3, 2024
1 parent e98046d commit adb1097
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 68 deletions.
2 changes: 0 additions & 2 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ RSpec/BeforeAfterAll:
# Prefixes: when, with, without
RSpec/ContextWording:
Exclude:
- 'gradle/**/*'
- 'hex/**/*'
- 'nuget/**/*'

# Offense count: 31
Expand Down
4 changes: 2 additions & 2 deletions hex/spec/dependabot/hex/file_updater/lockfile_updater_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
)
end

context "targeting 1.3.2" do
context "when the target version is 1.3.2" do
let(:target_version) { "1.3.2" }

it "updates the dependency version in the lockfile" do
Expand All @@ -102,7 +102,7 @@
end
end

context "targeting 1.3.6" do
context "when the target version is 1.3.6" do
let(:target_version) { "1.3.6" }

it "updates the dependency version in the lockfile" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
)
end

context "specified over multiple lines" do
context "when the specification is in multiple lines" do
let(:mixfile_fixture_name) { "git_source_multiple_lines" }

it "updates the right dependency" do
Expand Down
4 changes: 2 additions & 2 deletions hex/spec/dependabot/hex/metadata_finder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@
it { is_expected.to eq("https://github.com/phoenixframework/phoenix") }
end

context "for a git source" do
context "when using a git source" do
let(:hex_response) { nil }
let(:dependency_source) do
{ type: "git", url: "https://github.com/my_fork/phoenix" }
end

it { is_expected.to eq("https://github.com/my_fork/phoenix") }

context "that doesn't match a supported source" do
context "when it doesn't match a supported source" do
let(:dependency_source) do
{ type: "git", url: "https://example.com/my_fork/phoenix" }
end
Expand Down
12 changes: 6 additions & 6 deletions hex/spec/dependabot/hex/requirement_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
subject { requirement.satisfied_by?(version) }

context "with a Gem::Version" do
context "for the current version" do
context "when using the current version" do
let(:version) { Gem::Version.new("1.0.0") }

it { is_expected.to be(true) }
Expand All @@ -43,7 +43,7 @@
end
end

context "for an out-of-range version" do
context "when using an out-of-range version" do
let(:version) { Gem::Version.new("0.9.0") }

it { is_expected.to be(false) }
Expand All @@ -53,12 +53,12 @@
context "with a Hex::Version" do
let(:version) { Dependabot::Hex::Version.new(version_string) }

context "for the current version" do
context "when using the current version" do
let(:version_string) { "1.0.0" }

it { is_expected.to be(true) }

context "that includes a local version" do
context "when the specification includes a local version" do
let(:version_string) { "1.0.0+gc.1" }

it { is_expected.to be(true) }
Expand All @@ -69,15 +69,15 @@

it { is_expected.to be(false) }

context "that is satisfied by the version" do
context "when the specification is satisfied by the version" do
let(:version_string) { "1.0.0+gc.2" }

it { is_expected.to be(true) }
end
end
end

context "for an out-of-range version" do
context "when using an out-of-range version" do
let(:version_string) { "0.9.0" }

it { is_expected.to be(false) }
Expand Down
10 changes: 5 additions & 5 deletions hex/spec/dependabot/hex/update_checker/file_preparer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
.to include('@version String.trim("0.0.1")')
end

context "an the loading is done without a !" do
context "when the loading is done without a !" do
let(:mixfile_fixture_name) { "loads_file_without_bang" }

it "removes the call to load the file" do
Expand Down Expand Up @@ -143,7 +143,7 @@
expect(prepared_mixfile.content).to include('{:plug, ">= 1.3.0"}')
end

context "and a latest allowable version" do
context "when there is a latest allowable version" do
let(:latest_allowable_version) { Gem::Version.new("1.6.0") }

it "updates the requirement" do
Expand All @@ -152,14 +152,14 @@
end
end

context "and no version" do
context "when there is no version" do
let(:version) { nil }

it "updates the requirement" do
expect(prepared_mixfile.content).to include('{:plug, ">= 1.3.0"}')
end

context "but a pre-release requirement" do
context "when it is a pre-release requirement" do
let(:mixfile_fixture_name) { "prerelease_version" }
let(:dependency_name) { "phoenix" }
let(:requirements) do
Expand Down Expand Up @@ -205,7 +205,7 @@
)
end

context "that uses single quotes" do
context "when there are single quotes" do
let(:mixfile_fixture_name) { "git_source_with_charlist" }

it "updates the pin" do
Expand Down
26 changes: 13 additions & 13 deletions hex/spec/dependabot/hex/update_checker/requirements_updater_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
context "when there is a resolvable version" do
let(:latest_resolvable_version) { "1.5.0" }

context "and a full version was previously specified" do
context "when a full version was previously specified" do
let(:mixfile_req_string) { "1.2.3" }

its([:requirement]) { is_expected.to eq("1.5.0") }
Expand All @@ -99,60 +99,60 @@
end
end

context "and a partial version was previously specified" do
context "when a partial version was previously specified" do
let(:mixfile_req_string) { "0.1" }

its([:requirement]) { is_expected.to eq("1.5") }
end

context "and the new version has fewer digits than the old one" do
context "when the new version has fewer digits than the old one" do
let(:mixfile_req_string) { "1.1.0.1" }

its([:requirement]) { is_expected.to eq("1.5.0") }
end

context "and a tilde was previously specified" do
context "when a tilde was previously specified" do
let(:mixfile_req_string) { "~> 0.2.3" }

its([:requirement]) { is_expected.to eq("~> 1.5.0") }

context "specified at two digits" do
context "when the specification is two digits" do
let(:mixfile_req_string) { "~> 0.2" }

its([:requirement]) { is_expected.to eq("~> 1.5") }
end

context "that is already satisfied" do
context "when the specification is already satisfied" do
let(:mixfile_req_string) { "~> 1.2" }

its([:requirement]) { is_expected.to eq(mixfile_req_string) }
end
end

context "and a < was previously specified" do
context "when a < was previously specified" do
let(:mixfile_req_string) { "< 1.2.3" }

its([:requirement]) { is_expected.to eq("< 1.5.1") }

context "that is already satisfied" do
context "when the specification is already satisfied" do
let(:mixfile_req_string) { "< 2.0.0" }

its([:requirement]) { is_expected.to eq(mixfile_req_string) }
end
end

context "and there were multiple specifications" do
context "when there are multiple specifications" do
let(:mixfile_req_string) { "> 1.0.0 and < 1.2.0" }

its([:requirement]) { is_expected.to eq("> 1.0.0 and < 1.6.0") }

context "that are already satisfied" do
context "when the specifications are already satisfied" do
let(:mixfile_req_string) { "> 1.0.0 and < 2.0.0" }

its([:requirement]) { is_expected.to eq(mixfile_req_string) }
end

context "specified with an or" do
context "when the specification is specified with an or" do
let(:latest_resolvable_version) { "2.5.0" }

let(:mixfile_req_string) { "~> 0.2 or ~> 1.0" }
Expand All @@ -161,15 +161,15 @@
is_expected.to eq("~> 0.2 or ~> 1.0 or ~> 2.5")
end

context "one of which is already satisfied" do
context "when a specification is already satisfied" do
let(:mixfile_req_string) { "~> 0.2 or < 3.0.0" }

its([:requirement]) { is_expected.to eq(mixfile_req_string) }
end
end
end

context "and multiple mix.exs files specified the dependency" do
context "when there are multiple mix.exs files specification in the dependency" do
subject(:updated_requirements) { updater.updated_requirements }

let(:requirements) do
Expand Down
Loading

0 comments on commit adb1097

Please sign in to comment.