Skip to content

Commit

Permalink
TICtxtWrd-dcon: Test Improvements, Context Wording, ecosystem dev con…
Browse files Browse the repository at this point in the history
…tainers and docker. (#9863)

Co-authored-by: “Thavachelvam <“thavaahariharangit@git.com”>
  • Loading branch information
thavaahariharangit and “Thavachelvam authored May 30, 2024
1 parent 7c3cecc commit 288cf52
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 71 deletions.
2 changes: 0 additions & 2 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ RSpec/BeforeAfterAll:
# Prefixes: when, with, without
RSpec/ContextWording:
Exclude:
- 'devcontainers/**/*'
- 'docker/**/*'
- 'github_actions/**/*'
- 'go_modules/**/*'
- 'gradle/**/*'
Expand Down
20 changes: 10 additions & 10 deletions devcontainers/spec/dependabot/devcontainers/update_checker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

let(:dependency) { dependencies.find { |dep| dep.name == name } }

shared_context "in root" do
shared_context "when the config is in root" do
let(:project_name) { "config_in_root" }
let(:directory) { "/" }
end
Expand All @@ -53,13 +53,13 @@
context "when feature is out-of-date" do
let(:name) { "ghcr.io/codspace/versioning/foo" }

context "and config in root" do
include_context "in root"
context "when the config is in root" do
include_context "when the config is in root"

it { is_expected.to be_falsey }
end

context "and config in .devcontainer folder " do
context "when the config is in .devcontainer folder " do
let(:project_name) { "config_in_dot_devcontainer_folder" }
let(:directory) { "/.devcontainer" }

Expand All @@ -70,13 +70,13 @@
context "when feature is already up-to-date" do
let(:name) { "ghcr.io/codspace/versioning/bar" }

context "and config in root" do
include_context "in root"
context "when the config is in root" do
include_context "when the config is in root"

it { is_expected.to be_truthy }
end

context "and config in .devcontainer folder " do
context "when the config is in .devcontainer folder " do
let(:project_name) { "config_in_dot_devcontainer_folder" }
let(:directory) { "/.devcontainer" }

Expand All @@ -91,14 +91,14 @@
let(:name) { "ghcr.io/codspace/versioning/foo" }
let(:current_version) { "1.1.0" }

include_context "in root"
include_context "when the config is in root"

context "when all later versions are being ignored" do
let(:ignored_versions) { ["> #{current_version}"] }

it { is_expected.to eq(current_version) }

context "raise_on_ignored" do
context "when raise_on_ignored is enabled" do
let(:raise_on_ignored) { true }

it "raises an error" do
Expand All @@ -112,7 +112,7 @@

it { is_expected.to eq("2.0.0") }

context "raise_on_ignored" do
context "when raise_on_ignored is enabled" do
let(:raise_on_ignored) { true }

it { is_expected.to eq("2.0.0") }
Expand Down
10 changes: 5 additions & 5 deletions docker/spec/dependabot/docker/file_fetcher_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
.to match_array(%w(Dockerfile))
end

context "that has an invalid encoding" do
context "when an invalid encoding is present" do
let(:dockerfile_fixture) { fixture("github", "contents_image.json") }

it "raises a helpful error" do
Expand Down Expand Up @@ -124,7 +124,7 @@
.to match_array(%w(Dockerfile Dockerfile-base))
end

context "one of which has an invalid encoding" do
context "when an invalid encoding is present" do
let(:dockerfile_2_fixture) { fixture("github", "contents_image.json") }

it "fetches the first Dockerfile, and ignores the invalid one" do
Expand Down Expand Up @@ -207,7 +207,7 @@
.to match_array(%w(pod.yaml))
end

context "that has an invalid encoding" do
context "when an invalid encoding is present" do
let(:kubernetes_fixture) { fixture("github", "contents_image.json") }

it "raises a helpful error" do
Expand All @@ -216,7 +216,7 @@
end
end

context "that has an non-kubernetes YAML" do
context "when an non-kubernetes YAML is present" do
let(:kubernetes_fixture) { fixture("github", "contents_other_yaml.json") }

it "raises a helpful error" do
Expand Down Expand Up @@ -260,7 +260,7 @@
.to match_array(%w(deployment.yaml pod.yaml))
end

context "one of which has an invalid encoding" do
context "when an invalid encoding is present" do
let(:kubernetes_2_fixture) { fixture("github", "contents_image.json") }

it "fetches the first yaml, and ignores the invalid one" do
Expand Down
12 changes: 6 additions & 6 deletions docker/spec/dependabot/docker/file_parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
.and_return(status: 200, body: registry_tags)
end

context "that doesn't match any tags" do
context "when the digest doesn't match any tags" do
let(:registry_tags) do
fixture("docker", "registry_tags", "small_ubuntu.json")
end
Expand All @@ -241,7 +241,7 @@
its(:length) { is_expected.to eq(1) }
end

context "that matches a tag" do
context "when the digest matches a tag" do
before do
stub_request(:head, repo_url + "manifests/10.04")
.and_return(status: 404)
Expand Down Expand Up @@ -424,7 +424,7 @@
end
end

context "that are identical" do
context "when the lines are identical" do
let(:dockerfile_fixture_name) { "multiple_identical" }

its(:length) { is_expected.to eq(1) }
Expand Down Expand Up @@ -784,7 +784,7 @@
.and_return(status: 200, body: registry_tags)
end

context "that doesn't match any tags" do
context "when the digest doesn't match any tags" do
let(:registry_tags) do
fixture("docker", "registry_tags", "small_ubuntu.json")
end
Expand All @@ -800,7 +800,7 @@
its(:length) { is_expected.to eq(1) }
end

context "that matches a tag" do
context "when the digest matches a tag" do
before do
stub_request(:head, repo_url + "manifests/10.04")
.and_return(status: 404)
Expand Down Expand Up @@ -920,7 +920,7 @@
end
end

context "that are identical" do
context "when the lines are identical" do
let(:podfile_fixture_name) { "multiple_identical.yaml" }

its(:length) { is_expected.to eq(1) }
Expand Down
2 changes: 1 addition & 1 deletion docker/spec/dependabot/docker/requirement_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
let(:requirement_string) { "> 20.8.1.alpine3.18, < 20.9" }

context "with a Dependabot::Docker::Version" do
context "for the current version" do
context "when using the current version" do
let(:version) { Dependabot::Docker::Version.new("20.9.0-alpine3.18") }

it { is_expected.to eq(false) }
Expand Down
Loading

0 comments on commit 288cf52

Please sign in to comment.