From 3982be457497248d14e852aa6833a3848fcd0cf5 Mon Sep 17 00:00:00 2001
From: Hariharan Thavachelvam
<164553783+thavaahariharangit@users.noreply.github.com>
Date: Thu, 30 May 2024 15:10:24 +0100
Subject: [PATCH] TICtxtWrd-cmn: Test Improvements, Context Wording, ecosystem
common. (#9856)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* TICtxtWrd-common: Test Improvement, Context Wording, for ecosystem common.
* TICtxtWrd-cmn: Test Improvements, Context Wording, ecosystem common.
* TICtxtWrd-common: Updating as per review comments.
---------
Co-authored-by: “Thavachelvam <“thavaahariharangit@git.com”>
---
common/spec/dependabot/clients/azure_spec.rb | 8 +-
.../spec/dependabot/clients/bitbucket_spec.rb | 10 +-
.../dependabot/config/update_config_spec.rb | 2 +-
.../spec/dependabot/dependency_file_spec.rb | 12 +--
.../spec/dependabot/dependency_group_spec.rb | 4 +-
common/spec/dependabot/dependency_spec.rb | 2 +-
.../dependabot/file_fetchers/base_spec.rb | 54 +++++-----
.../file_parsers/base/dependency_set_spec.rb | 16 +--
.../file_updaters/artifact_updater_spec.rb | 2 +-
.../file_updaters/vendor_updater_spec.rb | 2 +-
.../dependabot/git_commit_checker_spec.rb | 98 +++++++++----------
.../dependabot/git_metadata_fetcher_spec.rb | 22 ++---
.../base/changelog_finder_spec.rb | 38 +++----
.../base/changelog_pruner_spec.rb | 8 +-
.../base/commits_finder_spec.rb | 28 +++---
.../base/release_finder_spec.rb | 24 ++---
.../dependabot/metadata_finders/base_spec.rb | 4 +-
.../pull_request_creator/azure_spec.rb | 6 +-
.../dependency_group_strategy_spec.rb | 6 +-
.../branch_namer/solo_strategy_spec.rb | 14 +--
.../pull_request_creator/branch_namer_spec.rb | 14 +--
.../pull_request_creator/github_spec.rb | 22 ++---
.../pull_request_creator/gitlab_spec.rb | 8 +-
.../pull_request_creator/labeler_spec.rb | 66 ++++++-------
.../link_and_mention_sanitizer_spec.rb | 26 ++---
.../message_builder_spec.rb | 88 ++++++++---------
.../pr_name_prefixer_spec.rb | 22 ++---
.../dependabot/pull_request_creator_spec.rb | 2 +-
.../pull_request_updater/github_spec.rb | 8 +-
.../spec/dependabot/security_advisory_spec.rb | 14 +--
common/spec/dependabot/source_spec.rb | 8 +-
.../dependabot/update_checkers/base_spec.rb | 50 +++++-----
.../spec/dependabot/wildcard_matcher_spec.rb | 8 +-
common/spec/dependabot/workspace/git_spec.rb | 4 +-
.../1_2_1_1_6_1_1.yml | 0
.../when_there_s_a_new_ref/1_2_1_1_6_1_1.yml | 0
.../1_1_1_7_1.yml | 0
.../finds_the_changelog.yml | 0
.../truncates_the_subject_line_sensibly.yml | 0
.../has_the_correct_message.yml | 0
.../has_the_correct_name.yml | 0
41 files changed, 350 insertions(+), 350 deletions(-)
rename common/spec/fixtures/vcr_cassettes/Dependabot_MetadataFinders_Base_ChangelogFinder/_changelog_text/with_a_github_repo/with_a_changelog/{for_a_git_dependency_with_multiple_sources => when_dealing_with_a_git_dependency_with_multiple_sources}/when_the_ref_has_changed/1_2_1_1_6_1_1.yml (100%)
rename common/spec/fixtures/vcr_cassettes/Dependabot_MetadataFinders_Base_ChangelogFinder/_changelog_text/with_a_github_repo/with_a_changelog/{for_a_git_dependency_with_multiple_sources => when_dealing_with_a_git_dependency_with_multiple_sources}/when_there_s_a_new_ref/1_2_1_1_6_1_1.yml (100%)
rename common/spec/fixtures/vcr_cassettes/Dependabot_MetadataFinders_Base_ChangelogFinder/_changelog_url/with_a_github_repo/{for_a_git_dependency_with_multiple_sources => when_dealing_with_a_git_dependency_with_multiple_sources}/1_1_1_7_1.yml (100%)
rename common/spec/fixtures/vcr_cassettes/Dependabot_MetadataFinders_Base_ChangelogFinder/_changelog_url/with_a_github_repo/{for_a_git_dependency_with_multiple_sources => when_dealing_with_a_git_dependency_with_multiple_sources}/finds_the_changelog.yml (100%)
rename common/spec/fixtures/vcr_cassettes/Dependabot_PullRequestCreator_MessageBuilder/_commit_message/with_a_PR_name_that_is_too_long/{and_the_directory_needs_to_be_truncated_too => when_the_directory_needs_to_be_truncated}/truncates_the_subject_line_sensibly.yml (100%)
rename common/spec/fixtures/vcr_cassettes/Dependabot_PullRequestCreator_MessageBuilder/_pr_message/{for_an_application => when_dealing_with_an_application}/with_multiple_git_source_requirements/has_the_correct_message.yml (100%)
rename common/spec/fixtures/vcr_cassettes/Dependabot_PullRequestCreator_MessageBuilder/_pr_name/{for_an_application => when_dealing_with_an_application}/with_multiple_git_source_requirements/has_the_correct_name.yml (100%)
diff --git a/common/spec/dependabot/clients/azure_spec.rb b/common/spec/dependabot/clients/azure_spec.rb
index 382fcc4f0a..f95866063c 100644
--- a/common/spec/dependabot/clients/azure_spec.rb
+++ b/common/spec/dependabot/clients/azure_spec.rb
@@ -372,7 +372,7 @@
end
describe "#get" do
- context "Using auth headers" do
+ context "when using auth headers" do
token = ":test_token"
encoded_token = Base64.encode64(":test_token").delete("\n")
bearer_token = "test_token"
@@ -418,8 +418,8 @@
include_examples "#get using auth headers", bearer_token_data
end
- context "Retries" do
- context "for GET" do
+ context "when dealing with Retries" do
+ context "when dealing with GET" do
it "with failure count <= max_retries" do
# Request succeeds (200) on second attempt.
stub_request(:get, base_url)
@@ -440,7 +440,7 @@
end
end
- context "for POST" do
+ context "when dealing with POST" do
before do
@request_body = "request body"
end
diff --git a/common/spec/dependabot/clients/bitbucket_spec.rb b/common/spec/dependabot/clients/bitbucket_spec.rb
index bcbbe8d4ba..02011a0057 100644
--- a/common/spec/dependabot/clients/bitbucket_spec.rb
+++ b/common/spec/dependabot/clients/bitbucket_spec.rb
@@ -96,7 +96,7 @@
let(:default_reviewers_url) { api_base_url + repo + "/default-reviewers?pagelen=100&fields=values.uuid,next" }
let(:pull_request_url) { api_base_url + repo + "/pullrequests" }
- context "create pull request successfully" do
+ context "when a pull request created successfully" do
before do
stub_request(:get, default_reviewers_url)
.with(headers: { "Authorization" => "Bearer #{access_token}" })
@@ -137,7 +137,7 @@
let(:status_params) { "?status=OPEN&status=MERGED&status=DECLINED&status=SUPERSEDED" }
let(:default_pull_requests_url) { api_base_url + repo + "/pullrequests" + status_params }
- context "no pull requests found with matching source and target branch" do
+ context "when no pull requests found with matching source and target branch" do
before do
stub_request(:get, default_pull_requests_url)
.with(headers: { "Authorization" => "Bearer #{access_token}" })
@@ -149,7 +149,7 @@
it { is_expected.to eq([]) }
end
- context "pull request found with matching source and target branch" do
+ context "when pull request found with matching source and target branch" do
before do
stub_request(:get, default_pull_requests_url)
.with(headers: { "Authorization" => "Bearer #{access_token}" })
@@ -183,7 +183,7 @@
}
end
- context "only open pull requests with matching source and target branch" do
+ context "when only open pull requests match source and target branch" do
subject(:pull_requests) do
client.pull_requests(repo, "source_branch", "target_branch", %w(OPEN))
end
@@ -223,7 +223,7 @@
}
end
- context "open pull requests where matching target branch" do
+ context "when open pull requests match target branch" do
subject(:pull_requests) do
client.pull_requests(repo, nil, "target_branch", %w(OPEN))
end
diff --git a/common/spec/dependabot/config/update_config_spec.rb b/common/spec/dependabot/config/update_config_spec.rb
index 973348a407..9307d29c3e 100644
--- a/common/spec/dependabot/config/update_config_spec.rb
+++ b/common/spec/dependabot/config/update_config_spec.rb
@@ -141,7 +141,7 @@
expect(ignored_versions).to eq([">= 0"])
end
- context "and ignore condition that must be normalized" do
+ context "when an ignore condition that must be normalized" do
let(:ignore_conditions) do
[Dependabot::Config::IgnoreCondition.new(dependency_name: "very=cool=package", versions: [">= 1"])]
end
diff --git a/common/spec/dependabot/dependency_file_spec.rb b/common/spec/dependabot/dependency_file_spec.rb
index 6703c77dc8..5a916e6056 100644
--- a/common/spec/dependabot/dependency_file_spec.rb
+++ b/common/spec/dependabot/dependency_file_spec.rb
@@ -24,13 +24,13 @@
described_class.new(name: "Gemfile", content: "a", directory: directory)
end
- context "that starts and ends with a slash" do
+ context "when starting and ending with a slash" do
let(:directory) { "/path/to/files/" }
it { is_expected.to eq("/path/to/files/Gemfile") }
end
- context "that doesn't start or end with a slash" do
+ context "when not starting or ending with a slash" do
let(:directory) { "path/to/files" }
it { is_expected.to eq("/path/to/files/Gemfile") }
@@ -63,13 +63,13 @@
described_class.new(name: "Gemfile", content: "a", directory: directory)
end
- context "that starts and ends with a slash" do
+ context "when starting and ending with a slash" do
let(:directory) { "/path/to/files" }
it { is_expected.to eq("/path/to/files") }
end
- context "that doesn't start or end with a slash" do
+ context "when not starting or ending with a slash" do
let(:directory) { "path/to/files" }
it { is_expected.to eq("/path/to/files") }
@@ -321,7 +321,7 @@
end
describe "#decoded_content" do
- context "for base64 encoded content" do
+ context "when dealing with a base64 encoded content" do
let(:file) do
described_class.new(
name: "example.gem",
@@ -335,7 +335,7 @@
end
end
- context "for utf-8 encoded content" do
+ context "when dealing with a utf-8 encoded content" do
let(:file) do
described_class.new(
name: "example.gem",
diff --git a/common/spec/dependabot/dependency_group_spec.rb b/common/spec/dependabot/dependency_group_spec.rb
index f1cfb3f700..a8cc5b939b 100644
--- a/common/spec/dependabot/dependency_group_spec.rb
+++ b/common/spec/dependabot/dependency_group_spec.rb
@@ -114,7 +114,7 @@
}
end
- context "before dependencies are assigned to the group" do
+ context "when no dependencies are assigned to the group" do
it "returns true if the dependency matches a pattern" do
expect(dependency_group.dependencies).to eq([])
expect(dependency_group.contains?(test_dependency1)).to be_truthy
@@ -131,7 +131,7 @@
end
end
- context "after dependencies are assigned to the group" do
+ context "when dependencies are assigned to the group" do
before do
dependency_group.dependencies << test_dependency1
end
diff --git a/common/spec/dependabot/dependency_spec.rb b/common/spec/dependabot/dependency_spec.rb
index ffdb929a3f..d0de3e8bd2 100644
--- a/common/spec/dependabot/dependency_spec.rb
+++ b/common/spec/dependabot/dependency_spec.rb
@@ -119,7 +119,7 @@
let(:groups) { [] }
let(:package_manager) { "dummy" }
- context "for a requirement that isn't top-level" do
+ context "when dealing with a requirement that isn't top-level" do
let(:dependency_args) do
{ name: "dep", requirements: [], package_manager: package_manager }
end
diff --git a/common/spec/dependabot/file_fetchers/base_spec.rb b/common/spec/dependabot/file_fetchers/base_spec.rb
index b7f4d30bdb..2465206a60 100644
--- a/common/spec/dependabot/file_fetchers/base_spec.rb
+++ b/common/spec/dependabot/file_fetchers/base_spec.rb
@@ -115,7 +115,7 @@ def fetch_files
it { is_expected.to eq("bb218f56b14c9653891f9e74264a383fa43fefbd") }
- context "that can't be found" do
+ context "when branch can't be found" do
before do
stub_request(:get, url + "/git/refs/heads/my_branch")
.with(headers: { "Authorization" => "token token" })
@@ -131,7 +131,7 @@ def fetch_files
end
end
- context "that returns an array (because it is a substring)" do
+ context "when returning an array (because it is a substring)" do
before do
stub_request(:get, url + "/git/refs/heads/my_branch")
.with(headers: { "Authorization" => "token token" })
@@ -375,7 +375,7 @@ def fetch_files
end
context "with a directory specified" do
- context "that ends in a slash" do
+ context "when ending in a slash" do
let(:directory) { "app/" }
let(:url) { "https://api.github.com/repos/#{repo}/contents/app/" }
@@ -386,7 +386,7 @@ def fetch_files
end
end
- context "that begins with a slash" do
+ context "when beginning with a slash" do
let(:directory) { "/app" }
let(:url) { "https://api.github.com/repos/#{repo}/contents/app/" }
@@ -397,7 +397,7 @@ def fetch_files
end
end
- context "that includes a slash" do
+ context "when including a slash" do
let(:directory) { "a/pp" }
let(:url) { "https://api.github.com/repos/#{repo}/contents/a/pp/" }
@@ -481,7 +481,7 @@ def fetch_files
its(:content) { is_expected.to include("octokit") }
end
- context "that is in a submodule (shallow)" do
+ context "when the file is in a submodule (shallow)" do
before do
stub_request(:get, url + "some/dir/req.txt?ref=sha")
.with(headers: { "Authorization" => "token token" })
@@ -545,7 +545,7 @@ def fetch_files
end
end
- context "that is in a submodule (deep)" do
+ context "when the file is in a submodule (deep)" do
before do
stub_request(:get, url + "some/dir/req.txt?ref=sha")
.with(headers: { "Authorization" => "token token" })
@@ -619,7 +619,7 @@ def fetch_files
end
end
- context "that is in a symlinked directory" do
+ context "when the file is in a symlinked directory" do
before do
stub_request(:get, url + "some/dir/req.txt?ref=sha")
.with(headers: { "Authorization" => "token token" })
@@ -806,7 +806,7 @@ def fetch_files
child_class.new(source: source, credentials: credentials)
end
- context "that ends in a slash" do
+ context "when ending with a slash" do
let(:directory) { "app/" }
let(:url) { project_url + "/repository/files/app%2F" }
@@ -817,7 +817,7 @@ def fetch_files
end
end
- context "that begins with a slash" do
+ context "when beginning with a slash" do
let(:directory) { "/app" }
let(:url) { project_url + "/repository/files/app%2F" }
@@ -828,7 +828,7 @@ def fetch_files
end
end
- context "that includes a slash" do
+ context "when including a slash" do
let(:directory) { "a/pp" }
let(:url) { project_url + "/repository/files/a%2Fpp%2F" }
@@ -886,7 +886,7 @@ def fetch_files
child_class.new(source: source, credentials: credentials)
end
- context "that ends in a slash" do
+ context "when ending with a slash" do
let(:directory) { "app/" }
let(:url) { repo_url + "/src/sha/app/requirements.txt" }
@@ -896,7 +896,7 @@ def fetch_files
end
end
- context "that begins with a slash" do
+ context "when beginning with a slash" do
let(:directory) { "/app" }
let(:url) { repo_url + "/src/sha/app/requirements.txt" }
@@ -906,7 +906,7 @@ def fetch_files
end
end
- context "that includes a slash" do
+ context "when including a slash" do
let(:directory) { "a/pp" }
let(:url) { repo_url + "/src/sha/a/pp/requirements.txt" }
@@ -972,7 +972,7 @@ def fetch_files
its(:content) { is_expected.to include("required_rubygems_version") }
end
- context "that can't be found" do
+ context "when the file can't be found" do
before do
stub_request(:get, repo_contents_url)
.to_return(status: 200,
@@ -1029,7 +1029,7 @@ def fetch_files
child_class.new(source: source, credentials: credentials)
end
- context "that ends in a slash" do
+ context "when ending in a slash" do
let(:directory) { "app/" }
let(:url) do
repo_url + "/items?path=app/requirements.txt" \
@@ -1043,7 +1043,7 @@ def fetch_files
end
end
- context "that begins with a slash" do
+ context "when beginning with a slash" do
let(:directory) { "/app" }
let(:url) do
repo_url + "/items?path=app/requirements.txt" \
@@ -1057,7 +1057,7 @@ def fetch_files
end
end
- context "that includes a slash" do
+ context "when including a slash" do
let(:directory) { "a/pp" }
let(:url) do
repo_url + "/items?path=a/pp/requirements.txt" \
@@ -1147,7 +1147,7 @@ def fetch_files
its(:content) { is_expected.to include("required_rubygems_version") }
end
- context "that can't be found" do
+ context "when the file can't be found" do
before do
stub_request(:get, repo_contents_url)
.to_return(status: 200,
@@ -1222,12 +1222,12 @@ def fetch_files
its(:content) { is_expected.to include("required_rubygems_version") }
end
- context "with a directory specified" do
+ context "with directory path specified" do
let(:file_fetcher_instance) do
child_class.new(source: source, credentials: credentials)
end
- context "that ends in a slash" do
+ context "when ending with a slash" do
before do
stubbed_cc_client
.stub_responses(
@@ -1248,7 +1248,7 @@ def fetch_files
end
end
- context "that beings with a slash" do
+ context "when beginning with a slash" do
before do
stubbed_cc_client
.stub_responses(
@@ -1269,7 +1269,7 @@ def fetch_files
end
end
- context "that includes a slash" do
+ context "when including a slash" do
before do
stubbed_cc_client
.stub_responses(
@@ -1457,7 +1457,7 @@ def optional
end
end
- context "file not found" do
+ context "when the file is not found" do
it "raises DependencyFileNotFound" do
expect { files }
.to raise_error(Dependabot::DependencyFileNotFound) do |error|
@@ -1466,7 +1466,7 @@ def optional
end
end
- context "symlink" do
+ context "when the directory is symlinked" do
let(:fill_repo) do
Dir.mkdir("symlinked")
file_path = File.join("symlinked", "requirements.txt")
@@ -1505,7 +1505,7 @@ def fetch_files
end
end
- context "file not found" do
+ context "when the file is not found" do
it "raises DependencyFileNotFound" do
expect { files }
.to raise_error(Dependabot::DependencyFileNotFound) do |error|
@@ -1538,7 +1538,7 @@ def fetch_files
context "with a directory specified" do
let(:directory) { "/nested" }
- context "file not found" do
+ context "when the file is not found" do
it "raises DependencyFileNotFound" do
expect { files }
.to raise_error(Dependabot::DependencyFileNotFound) do |error|
diff --git a/common/spec/dependabot/file_parsers/base/dependency_set_spec.rb b/common/spec/dependabot/file_parsers/base/dependency_set_spec.rb
index 220b2cc509..0d28b50d53 100644
--- a/common/spec/dependabot/file_parsers/base/dependency_set_spec.rb
+++ b/common/spec/dependabot/file_parsers/base/dependency_set_spec.rb
@@ -30,7 +30,7 @@
it { is_expected.to be_a(described_class) }
its(:dependencies) { is_expected.to eq([dependency]) }
- context "that contains non-dependency objects" do
+ context "when an argument contains non-dependency objects" do
subject { described_class.new([dependency, :a]) }
it "raises a helpful error" do
@@ -63,7 +63,7 @@
context "when a dependency already exists in the set" do
before { dependency_set << existing_dependency }
- context "and is identical to the one being added" do
+ context "when identical to the one being added" do
let(:existing_dependency) { dependency }
it { is_expected.to be_a(described_class) }
@@ -84,7 +84,7 @@
)
end
- context "acting case-sensitively" do
+ context "when acting case-sensitively" do
let(:dependency_set) { described_class.new(case_sensitive: true) }
it { is_expected.to be_a(described_class) }
@@ -94,14 +94,14 @@
end
end
- context "acting case-insensitively (the default)" do
+ context "when acting case-insensitively (the default)" do
it { is_expected.to be_a(described_class) }
its(:dependencies) { is_expected.to eq([existing_dependency]) }
end
end
end
- context "and is different to the one being added" do
+ context "when different to the one being added" do
let(:existing_dependency) do
Dependabot::Dependency.new(
name: "statesman",
@@ -119,7 +119,7 @@
end
end
- context "and is identical, but with different requirements" do
+ context "when identical but with different requirements" do
let(:existing_dependency) do
Dependabot::Dependency.new(
name: "business",
@@ -144,7 +144,7 @@
end
end
- context "and is identical, but with different subdependency_metadata" do
+ context "when identical but with different subdependency_metadata" do
let(:existing_subdependency_metadata) { [{ npm_bundled: true }] }
let(:subdependency_metadata) { [{ npm_bundled: false }] }
let(:existing_dependency) do
@@ -352,7 +352,7 @@
])
end
- context "and the same version is added multiple times" do
+ context "when the same version is added multiple times" do
it "combines each into the the existing version" do
dependency_set = described_class.new << foo_v1_1 << foo_v1_1_alt << foo_sha
diff --git a/common/spec/dependabot/file_updaters/artifact_updater_spec.rb b/common/spec/dependabot/file_updaters/artifact_updater_spec.rb
index c3c9d2b83b..8d86ae1578 100644
--- a/common/spec/dependabot/file_updaters/artifact_updater_spec.rb
+++ b/common/spec/dependabot/file_updaters/artifact_updater_spec.rb
@@ -144,7 +144,7 @@
end
end
- context "in a directory" do
+ context "when in a directory" do
let(:project_name) { "nested_vendor_gems" }
let(:directory) { "nested" }
diff --git a/common/spec/dependabot/file_updaters/vendor_updater_spec.rb b/common/spec/dependabot/file_updaters/vendor_updater_spec.rb
index 65898e4064..1ef2614195 100644
--- a/common/spec/dependabot/file_updaters/vendor_updater_spec.rb
+++ b/common/spec/dependabot/file_updaters/vendor_updater_spec.rb
@@ -143,7 +143,7 @@
end
end
- context "in a directory" do
+ context "when in a directory" do
let(:project_name) { "nested_vendor_gems" }
let(:directory) { "nested" }
diff --git a/common/spec/dependabot/git_commit_checker_spec.rb b/common/spec/dependabot/git_commit_checker_spec.rb
index a4cb85b62a..acfee756ac 100644
--- a/common/spec/dependabot/git_commit_checker_spec.rb
+++ b/common/spec/dependabot/git_commit_checker_spec.rb
@@ -116,7 +116,7 @@
let(:s1) { source }
- context "with both of which are git, with the same URL" do
+ context "when both are git, with the same URL" do
let(:s2) do
{
type: "git",
@@ -188,13 +188,13 @@
let(:upload_pack_fixture) { "no_tags" }
- context "when but no tags on GitHub" do
+ context "when there are no tags on GitHub" do
let(:upload_pack_fixture) { "no_tags" }
it { is_expected.to eq(false) }
end
- context "when but GitHub returns a 404" do
+ context "when GitHub returns a 404" do
let(:url) { "https://github.com/gocardless/business.git" }
before do
@@ -236,7 +236,7 @@
it { is_expected.to eq(true) }
- context "when even though this fork is not on GitHub" do
+ context "when the fork is not on GitHub" do
let(:source) do
{
type: "git",
@@ -280,7 +280,7 @@
it { is_expected.to eq(true) }
- context "when that has no branch specified" do
+ context "when a source has no branch specified" do
let(:branch) { nil }
let(:comparison_url) { "unused" }
let(:comparison_response) { "unused" }
@@ -411,13 +411,13 @@
context "with no branch specified" do
let(:branch) { nil }
- context "with a reference that matches the version" do
+ context "when a reference matches the version" do
let(:ref) { "df9f605" }
it { is_expected.to eq(true) }
end
- context "with a reference that does not match the version" do
+ context "when a reference that does not match the version" do
let(:repo_url) { "https://github.com/gocardless/business.git" }
before do
@@ -431,13 +431,13 @@
)
end
- context "with does not match any branch names" do
+ context "when a reference does not match any branch names" do
let(:ref) { "my_ref" }
it { is_expected.to eq(true) }
end
- context "with does match a branch names" do
+ context "when a reference matches a branch names" do
let(:ref) { "master" }
it { is_expected.to eq(false) }
@@ -480,8 +480,8 @@
end
end
- context "when the source returns a timeout" do
- context "with is unknown" do
+ context "when a source returns a timeout" do
+ context "when the source is unknown" do
let(:source) do
{
type: "git",
@@ -504,7 +504,7 @@
end
end
- context "when but is GitHub" do
+ context "when the source is GitHub" do
before do
url = "https://github.com/gocardless/business.git"
stub_request(:get, url + "/info/refs?service=git-upload-pack")
@@ -546,7 +546,7 @@
"/info/refs?service=git-upload-pack"
end
- context "when that can be reached just fine" do
+ context "when the source can be reached just fine" do
before do
stub_request(:get, git_url)
.with(headers: { "Authorization" => auth_header })
@@ -564,7 +564,7 @@
it { is_expected.to eq("df9f605d7111b6814fe493cf8f41de3f9f0978b2") }
- context "when but doesn't have details of the current branch" do
+ context "when there are no details of the current branch" do
before { source.merge!(ref: "rando") }
it { is_expected.to be_nil }
@@ -592,7 +592,7 @@
"/info/refs?service=git-upload-pack"
end
- context "when that can be reached just fine" do
+ context "when the source can be reached just fine" do
before do
stub_request(:get, git_url)
.with(headers: { "Authorization" => auth_header })
@@ -645,13 +645,13 @@
end
end
- context "with specified with an SSH URL" do
+ context "when the source is specified with an SSH URL" do
before { source.merge!(url: "git@github.com:gocardless/business") }
it { is_expected.to eq("7bb4e41ce5164074a0920d5b5770d196b4d90104") }
end
- context "with specified with a git URL" do
+ context "when the source is specified with a git URL" do
before do
source.merge!(url: "git://github.com/gocardless/business.git")
end
@@ -659,7 +659,7 @@
it { is_expected.to eq("7bb4e41ce5164074a0920d5b5770d196b4d90104") }
end
- context "when but doesn't have details of the current branch" do
+ context "when there are no details of the current branch" do
before { source.merge!(branch: "rando", ref: "rando") }
it "raises a helpful error" do
@@ -669,7 +669,7 @@
end
end
- context "when that results in a 403" do
+ context "when the result is 403" do
let(:url) { "https://github.com/gocardless/business.git" }
before do
@@ -702,7 +702,7 @@
"/info/refs?service=git-upload-pack"
end
- context "when that needs credentials to succeed" do
+ context "when the URL needs credentials to succeed" do
before do
stub_request(:get, git_url).to_return(status: 403)
stub_request(:get, git_url)
@@ -714,14 +714,14 @@
)
end
- context "with doesn't have them" do
+ context "when the URL doesn't have the credentials" do
it "raises a helpful error" do
expect { checker.head_commit_for_current_branch }
.to raise_error(Dependabot::GitDependenciesNotReachable)
end
end
- context "with has them" do
+ context "when the url has the credentials" do
let(:credentials) do
[{
"type" => "git_source",
@@ -733,7 +733,7 @@
it { is_expected.to eq("7bb4e41ce5164074a0920d5b5770d196b4d90104") }
- context "with already encoded in the URL" do
+ context "when the credentials are already encoded in the URL" do
let(:source) do
{
type: "git",
@@ -782,7 +782,7 @@
it { is_expected.to eq(true) }
- context "when that includes a hyphen" do
+ context "when including a hyphen" do
let(:source) do
{
type: "git",
@@ -795,7 +795,7 @@
it { is_expected.to eq(true) }
end
- context "when that is just v1" do
+ context "when the source reference is just v1" do
let(:source) do
{
type: "git",
@@ -892,7 +892,7 @@
it { is_expected.to eq(true) }
- context "when that matches a tag" do
+ context "when the ref matches a tag" do
let(:source) do
{
type: "git",
@@ -965,7 +965,7 @@
it { is_expected.to eq(nil) }
end
- context "when but GitHub returns a 404" do
+ context "when GitHub returns a 404" do
let(:url) { "https://github.com/gocardless/business.git" }
before do
@@ -983,7 +983,7 @@
end
context "with tags on GitHub" do
- context "when but no version tags" do
+ context "when there are no version tags" do
let(:upload_pack_fixture) { "no_versions" }
it { is_expected.to eq(nil) }
@@ -1002,7 +1002,7 @@
is_expected.to eq("37f41032a0f191507903ebbae8a5c0cb945d7585")
end
- context "with a pre-release latest version" do
+ context "when there is a pre-release latest version" do
let(:upload_pack_fixture) { "k8s-apiextensions-apiserver" }
its([:tag]) { is_expected.to eq("kubernetes-1.11.2") }
@@ -1021,7 +1021,7 @@
end
end
- context "with a monorepo using prefixed tags" do
+ context "when dealing with a monorepo using prefixed tags" do
let(:upload_pack_fixture) { "gatsby" }
let(:source) do
{
@@ -1035,7 +1035,7 @@
its([:tag]) { is_expected.to eq("gatsby-transformer-sqip@2.0.40") }
end
- context "with raise_on_ignored when later versions are allowed" do
+ context "when raise_on_ignored is enabled and later versions are allowed" do
let(:raise_on_ignored) { true }
it "doesn't raise an error" do
@@ -1043,12 +1043,12 @@
end
end
- context "with already on the latest version" do
+ context "when already on the latest version" do
let(:version) { "1.13.0" }
its([:tag]) { is_expected.to eq("v1.13.0") }
- context "with raise_on_ignored" do
+ context "when raise_on_ignored is enabled" do
let(:raise_on_ignored) { true }
it "doesn't raise an error" do
@@ -1057,13 +1057,13 @@
end
end
- context "with all later versions ignored" do
+ context "when all later versions are ignored" do
let(:version) { "1.0.0" }
let(:ignored_versions) { ["> 1.0.0"] }
its([:tag]) { is_expected.to eq("v1.0.0") }
- context "with raise_on_ignored" do
+ context "when raise_on_ignored is enabled" do
let(:raise_on_ignored) { true }
it "raises an error" do
@@ -1072,26 +1072,26 @@
end
end
- context "with an ignore condition" do
+ context "when an ignore condition is present" do
let(:ignored_versions) { [">= 1.12.0"] }
its([:tag]) { is_expected.to eq("v1.11.1") }
end
- context "with multiple ignore conditions" do
+ context "when there are multiple ignore conditions" do
let(:ignored_versions) { [">= 1.11.2, < 1.12.0"] }
its([:tag]) { is_expected.to eq("v1.13.0") }
end
- context "with all versions ignored" do
+ context "when all versions are ignored" do
let(:ignored_versions) { [">= 0"] }
it "returns nil" do
expect(local_tag_for_latest_version).to be_nil
end
- context "with raise_on_ignored" do
+ context "when raise_on_ignored is enabled" do
let(:raise_on_ignored) { true }
it "raises an error" do
@@ -1100,7 +1100,7 @@
end
end
- context "with a ref prefixed with tags/" do
+ context "when a ref prefixed with tags/" do
let(:source) do
{
type: "git",
@@ -1402,31 +1402,31 @@
let(:upload_pack_fixture) { "actions-checkout" }
- context "when that is a tag" do
+ context "when the source commit is a tag" do
let(:source_commit) { "a81bbbf8298c0fa03ea29cdc473d45769f953675" }
it { is_expected.to eq("v2.3.3") }
end
- context "when that is not a tag" do
+ context "when the source commit is not a tag" do
let(:source_commit) { "25a956c84d5dd820d28caab9f86b8d183aeeff3d" }
it { is_expected.to be_nil }
end
- context "when that is an invalid tag" do
+ context "when using an invalid tag" do
let(:source_commit) { "18217bbd6de24e775799c3d99058f167ad168624" }
it { is_expected.to be_nil }
end
- context "when that is not found" do
+ context "when the source commit is not found" do
let(:source_commit) { "f0987d27b23cb3fd0e97eb7908c1a27df5bf8329" }
it { is_expected.to be_nil }
end
- context "when that is multiple tags" do
+ context "when there are multiple tags" do
let(:source_commit) { "5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f" }
it { is_expected.to eq("v2.3.4") }
@@ -1461,13 +1461,13 @@
let(:upload_pack_fixture) { "actions-checkout-moving-v2" }
- context "with a moving major tag" do
+ context "when moving major tag" do
let(:source_ref) { "v2" }
it { is_expected.to eq("v2.3.4") }
end
- context "with a fixed patch tag" do
+ context "when using a fixed patch tag" do
let(:source_ref) { "v2.3.4" }
it { is_expected.to eq("v2.3.4") }
@@ -1495,7 +1495,7 @@
"/info/refs?service=git-upload-pack"
end
- context "when that can be reached just fine" do
+ context "when the source can be reached just fine" do
before do
stub_request(:get, git_url)
.with(headers: { "Authorization" => auth_header })
@@ -1509,7 +1509,7 @@
it { is_expected.to eq(true) }
end
- context "when that results in a 403" do
+ context "when the results is 403" do
let(:url) { "https://github.com/gocardless/business.git" }
before do
diff --git a/common/spec/dependabot/git_metadata_fetcher_spec.rb b/common/spec/dependabot/git_metadata_fetcher_spec.rb
index 05b0d21c00..3594f3c822 100644
--- a/common/spec/dependabot/git_metadata_fetcher_spec.rb
+++ b/common/spec/dependabot/git_metadata_fetcher_spec.rb
@@ -42,23 +42,23 @@
end
let(:upload_pack_fixture) { "no_tags" }
- context "but no tags on GitHub" do
+ context "when there are no tags on GitHub" do
let(:upload_pack_fixture) { "no_tags" }
it { is_expected.to eq([]) }
- context "and a git@... URL" do
+ context "when using a git@... URL" do
let(:url) { "git@github.com:gocardless/business" }
it { is_expected.to eq([]) }
- context "that separates with :/" do
+ context "when separating with :/" do
let(:url) { "git@github.com:/gocardless/business" }
it { is_expected.to eq([]) }
end
- context "that separates with /" do
+ context "when separating with /" do
let(:url) { "git@github.com/gocardless/business" }
it { is_expected.to eq([]) }
@@ -66,7 +66,7 @@
end
end
- context "but GitHub returns a 404" do
+ context "when GitHub returns a 404" do
let(:uri) { "https://github.com/gocardless/business.git" }
before do
@@ -83,7 +83,7 @@
end
end
- context "but GitHub returns a 401" do
+ context "when GitHub returns a 401" do
let(:uri) { "https://github.com/gocardless/business.git" }
before do
@@ -100,7 +100,7 @@
end
end
- context "but GitHub returns a 500" do
+ context "when GitHub returns a 500" do
let(:uri) { "https://github.com/gocardless/business.git" }
before do
@@ -256,13 +256,13 @@
it { is_expected.to eq(%w(master imported release)) }
end
- context "but no tags on GitHub" do
+ context "when there are no tags on GitHub" do
let(:upload_pack_fixture) { "no_tags" }
it { is_expected.to eq(%w(master rails5)) }
end
- context "but GitHub returns a 404" do
+ context "when GitHub returns a 404" do
let(:uri) { "https://github.com/gocardless/business.git" }
before do
@@ -332,13 +332,13 @@
it { is_expected.to eq("7bb4e41ce5164074a0920d5b5770d196b4d90104") }
- context "that doesn't exist" do
+ context "when the reference doesn't exist" do
let(:ref) { "nonexistent" }
it { is_expected.to be_nil }
end
- context "that is HEAD" do
+ context "when the reference is HEAD" do
let(:ref) { "HEAD" }
it { is_expected.to eq("7bb4e41ce5164074a0920d5b5770d196b4d90104") }
diff --git a/common/spec/dependabot/metadata_finders/base/changelog_finder_spec.rb b/common/spec/dependabot/metadata_finders/base/changelog_finder_spec.rb
index bead7cb36f..80352f3c5b 100644
--- a/common/spec/dependabot/metadata_finders/base/changelog_finder_spec.rb
+++ b/common/spec/dependabot/metadata_finders/base/changelog_finder_spec.rb
@@ -187,7 +187,7 @@
)
end
- context "and the URL has a fragment" do
+ context "when there is a fragment in the URL" do
let(:suggested_changelog_url) do
"https:/github.com/mperham/sidekiq/blob/master/Pro-Changes.md#v2.8.6"
end
@@ -200,7 +200,7 @@
end
end
- context "that can't be found" do
+ context "when the repo can't be found" do
before do
suggested_github_url =
"https://api.github.com/repos/mperham/sidekiq/contents/"
@@ -234,7 +234,7 @@
it { is_expected.to be_nil }
- context "but with a changelog on the tag" do
+ context "when the tag has changelog" do
before do
stub_request(:get, github_url + "?ref=v1.4.0")
.to_return(status: github_status,
@@ -362,7 +362,7 @@
expect(WebMock).to have_requested(:get, github_url).once
end
- context "that isn't a directory" do
+ context "when the target isn't a directory" do
before do
stub_request(:get, github_url + "packages/stryker")
.to_return(status: github_status,
@@ -443,7 +443,7 @@
end
end
- context "for a git dependency with multiple sources", :vcr do
+ context "when dealing with a git dependency with multiple sources", :vcr do
include_context "with multiple git sources"
before do
@@ -457,7 +457,7 @@
end
end
- context "for a git dependency" do
+ context "when dealing with a git dependency" do
let(:github_response) { fixture("github", "business_files.json") }
let(:dependency_requirements) do
[{
@@ -552,7 +552,7 @@
)
end
- context "that can't be found exists" do
+ context "when the repo can't be found" do
let(:gitlab_status) { 404 }
let(:gitlab_response) { fixture("gitlab", "not_found.json") }
@@ -637,13 +637,13 @@
)
end
- context "that can't be found exists" do
+ context "when the repo can't be found" do
let(:azure_status) { 404 }
it { is_expected.to be_nil }
end
- context "that is private" do
+ context "when the repo is private" do
let(:azure_status) { 403 }
it { is_expected.to be_nil }
@@ -716,13 +716,13 @@
)
end
- context "that can't be found exists" do
+ context "when the repo can't be found" do
let(:bitbucket_status) { 404 }
it { is_expected.to be_nil }
end
- context "that is private" do
+ context "when the repo is private" do
let(:bitbucket_status) { 403 }
it { is_expected.to be_nil }
@@ -734,7 +734,7 @@
it { is_expected.to be_nil }
- context "for a docker dependency" do
+ context "when dealing with a docker dependency" do
let(:dependency_requirements) do
[{
file: "Dockerfile",
@@ -821,7 +821,7 @@
expect(WebMock).to have_requested(:get, github_changelog_url).once
end
- context "that has non-standard characters" do
+ context "when dealing with non-standard characters" do
let(:changelog_body) do
fixture("github", "changelog_contents_japanese.json")
end
@@ -830,13 +830,13 @@
it { is_expected.to start_with("!! 0.0.5から0.0.6の変更点:") }
end
- context "that is an image" do
+ context "when dealing with an image" do
let(:changelog_body) { fixture("github", "contents_image.json") }
it { is_expected.to be_nil }
end
- context "for a git dependency" do
+ context "when dealing with a git dependency" do
let(:dependency_requirements) do
[{
file: "Gemfile",
@@ -876,7 +876,7 @@
end
end
- context "for a git dependency with multiple sources", :vcr do
+ context "when dealing with a git dependency with multiple sources", :vcr do
include_context "with multiple git sources"
let(:expected_pruned_changelog) do
@@ -890,7 +890,7 @@
end
end
- context "that uses restructured text format" do
+ context "when using restructured text format" do
let(:github_contents_response) do
fixture("github", "scrapy_docs_files.json")
end
@@ -1099,14 +1099,14 @@
fixture("github", "business_files_with_upgrade_guide.json")
end
- context "for a minor update" do
+ context "when dealing with a minor update" do
let(:dependency_version) { "1.4.0" }
let(:dependency_previous_version) { "1.3.0" }
it { is_expected.to be_nil }
end
- context "for a major update" do
+ context "when dealing with a major update" do
let(:dependency_version) { "1.4.0" }
let(:dependency_previous_version) { "0.9.0" }
diff --git a/common/spec/dependabot/metadata_finders/base/changelog_pruner_spec.rb b/common/spec/dependabot/metadata_finders/base/changelog_pruner_spec.rb
index 8e9be9f422..747a7ebc4a 100644
--- a/common/spec/dependabot/metadata_finders/base/changelog_pruner_spec.rb
+++ b/common/spec/dependabot/metadata_finders/base/changelog_pruner_spec.rb
@@ -159,7 +159,7 @@
it { is_expected.to eq(expected_pruned_changelog) }
- context "that has non-standard characters" do
+ context "when dealing with non-standard characters" do
let(:changelog_body) do
fixture("github", "changelog_contents_japanese.json")
end
@@ -168,7 +168,7 @@
it { is_expected.to start_with("!! 0.0.5から0.0.6の変更点:") }
end
- context "where the old version is a substring of the new one" do
+ context "when the old version is a substring of the new one" do
let(:changelog_text) { fixture("changelogs", "rails52.md") }
let(:dependency_version) { "5.2.1.1" }
let(:dependency_previous_version) { "5.2.1" }
@@ -179,7 +179,7 @@
end
end
- context "that is in reverse order" do
+ context "when in reverse order" do
let(:changelog_body) do
fixture("github", "changelog_contents_reversed.json")
end
@@ -269,7 +269,7 @@
expect(pruned_text).to end_with("- Add 2015 holiday definitions")
end
- context "and the previous version is the latest in the changelog" do
+ context "when the previous version is the latest in the changelog" do
let(:dependency_previous_version) { "1.11.1" }
it { is_expected.to be_nil }
diff --git a/common/spec/dependabot/metadata_finders/base/commits_finder_spec.rb b/common/spec/dependabot/metadata_finders/base/commits_finder_spec.rb
index cac9ab83dd..65a767f3fb 100644
--- a/common/spec/dependabot/metadata_finders/base/commits_finder_spec.rb
+++ b/common/spec/dependabot/metadata_finders/base/commits_finder_spec.rb
@@ -107,7 +107,7 @@
.to eq("https://github.com/gocardless/business/commits/v1.4.0")
end
- context "and a directory" do
+ context "when there is a directory" do
before { source.directory = "my/directory" }
it "doesn't include the directory (since it is unreliable)" do
@@ -115,7 +115,7 @@
.to eq("https://github.com/gocardless/business/commits/v1.4.0")
end
- context "for a package manager with reliable source directories" do
+ context "when dealing with a package manager with reliable source directories" do
before do
allow(builder)
.to receive(:reliable_source_directory?)
@@ -166,7 +166,7 @@
"commits/business-1.4")
end
- context "for a monorepo" do
+ context "when dealing with a monorepo" do
let(:dependency_name) { "@pollyjs/ember" }
let(:dependency_version) { "0.2.0" }
let(:dependency_previous_version) { "0.0.1" }
@@ -495,7 +495,7 @@
end
end
- context "for the previous requirement only" do
+ context "when dealing with the previous requirement only" do
let(:dependency_requirements) do
[{ file: "Gemfile", requirement: ">= 0", groups: [], source: nil }]
end
@@ -555,7 +555,7 @@
.to eq("https://github.com/gocardless/business/commits/v1.4.0")
end
- context "but with a previously specified reference" do
+ context "when there is a previously specified reference" do
let(:dependency_previous_requirements) do
[{
file: "Gemfile",
@@ -622,7 +622,7 @@
end
end
- context "no tags" do
+ context "when there are no tags" do
let(:dependency_previous_version) { "0.3.0" }
let(:dependency_version) { "0.5.0" }
@@ -686,7 +686,7 @@
end
end
- context "no tags" do
+ context "when there are no tags" do
let(:dependency_previous_version) { "0.3.0" }
let(:dependency_version) { "0.5.0" }
@@ -695,7 +695,7 @@
end
end
- context "no previous version" do
+ context "when there is no previous version" do
let(:dependency_previous_version) { nil }
let(:dependency_version) { "0.5.0" }
@@ -796,7 +796,7 @@
end
end
- context "no tags" do
+ context "when there are no tags" do
let(:dependency_previous_version) { "0.3.0" }
let(:dependency_version) { "0.5.0" }
@@ -805,7 +805,7 @@
end
end
- context "no previous version" do
+ context "when there is no previous version" do
let(:dependency_previous_version) { nil }
let(:dependency_version) { "0.5.0" }
@@ -901,7 +901,7 @@
)
end
- context "that 404s" do
+ context "when receiving a 404 response" do
before do
response = {
message: "No common ancestor between v4.7.0 and 5.0.8."
@@ -921,7 +921,7 @@
it { is_expected.to eq([]) }
end
- context "for a monorepo" do
+ context "when dealing with a monorepo" do
let(:dependency_name) { "@pollyjs/ember" }
let(:dependency_version) { "0.2.0" }
let(:dependency_previous_version) { "0.1.0" }
@@ -1156,7 +1156,7 @@
)
end
- context "that 404s" do
+ context "when receiving a 404 response" do
before do
response = { message: "404 Project Not Found" }.to_json
stub_request(:get, azure_compare_url)
@@ -1250,7 +1250,7 @@
"7638417db6d59f3c431d3e1f261cc637155684cd"
end
- context "that 404s" do
+ context "when receiving a 404 response" do
before do
response = { message: "404 Project Not Found" }.to_json
gitlab_compare_url =
diff --git a/common/spec/dependabot/metadata_finders/base/release_finder_spec.rb b/common/spec/dependabot/metadata_finders/base/release_finder_spec.rb
index 3b4d349e7d..8973cc9f9f 100644
--- a/common/spec/dependabot/metadata_finders/base/release_finder_spec.rb
+++ b/common/spec/dependabot/metadata_finders/base/release_finder_spec.rb
@@ -146,7 +146,7 @@
context "when the release is present" do
let(:dependency_version) { "1.8.0" }
- context "and is updating from one version previous" do
+ context "when updating from one version previous" do
let(:dependency_previous_version) { "1.7.0" }
it "gets the right text" do
@@ -206,7 +206,7 @@
end
end
- context "but prefixed" do
+ context "when the release is prefixed" do
let(:github_response) do
fixture("github", "prefixed_releases.json")
end
@@ -221,21 +221,21 @@
end
end
- context "but is blank" do
+ context "when the release is blank" do
let(:dependency_version) { "1.7.0" }
let(:dependency_previous_version) { "1.7.0.beta" }
it { is_expected.to be_nil }
end
- context "but is nil" do
+ context "when the release is nil" do
let(:dependency_version) { "1.7.0.beta" }
let(:dependency_previous_version) { "1.7.0.alpha" }
it { is_expected.to be_nil }
end
- context "but has blank names" do
+ context "when there are blank names" do
let(:github_response) do
fixture("github", "releases_no_names.json")
end
@@ -258,7 +258,7 @@
it { is_expected.to be_nil }
end
- context "but has tag names with dashes, and it's Java" do
+ context "when tag names have dashes and it's Java" do
let(:github_response) do
fixture("github", "releases_dash_tags.json")
end
@@ -284,7 +284,7 @@
end
end
- context "and is updating from several versions previous" do
+ context "when updating from several versions previous" do
let(:dependency_previous_version) { "1.6.0" }
it "gets the right text" do
@@ -305,7 +305,7 @@
)
end
- context "but all versions are blank or nil" do
+ context "when all versions are blank or nil" do
let(:dependency_version) { "1.7.0" }
it { is_expected.to be_nil }
@@ -337,7 +337,7 @@
end
end
- context "and the previous release doesn't have a github release" do
+ context "when the previous release doesn't have a github release" do
let(:dependency_previous_version) { "1.5.1" }
it "uses the version number to filter the releases" do
@@ -365,7 +365,7 @@
end
end
- context "updating from no previous release to new release", :vcr do
+ describe "updating from no previous release to new release", :vcr do
let(:dependency_name) { "actions/checkout" }
let(:dependency_version) do
"aabbfeb2ce60b5bd82389903509092c4648a9713"
@@ -438,7 +438,7 @@
it { is_expected.to be_nil }
- context "and there is a blank named release that needs excluding" do
+ context "when there is a blank named release that needs excluding" do
let(:github_response) do
fixture("github", "releases_ember_cp.json")
end
@@ -448,7 +448,7 @@
it { is_expected.to be_nil }
end
- context "but has 'Fix #123' names" do
+ context "when the release has 'Fix #123' names" do
let(:dependency_version) { "2.1.0" }
let(:dependency_previous_version) { "2.0.0" }
let(:github_response) do
diff --git a/common/spec/dependabot/metadata_finders/base_spec.rb b/common/spec/dependabot/metadata_finders/base_spec.rb
index 900784b20a..cfdcf94cf8 100644
--- a/common/spec/dependabot/metadata_finders/base_spec.rb
+++ b/common/spec/dependabot/metadata_finders/base_spec.rb
@@ -66,7 +66,7 @@
it { is_expected.to be_nil }
end
- context "and a directory" do
+ context "when there is a directory" do
before { source.directory = "my/directory" }
it "doesn't include the directory (since it is unreliable)" do
@@ -74,7 +74,7 @@
.to eq("https://github.com/gocardless/business")
end
- context "for a package manager with reliable source directories" do
+ context "when there is a package manager with reliable source directories" do
before do
allow(finder)
.to receive(:reliable_source_directory?)
diff --git a/common/spec/dependabot/pull_request_creator/azure_spec.rb b/common/spec/dependabot/pull_request_creator/azure_spec.rb
index 7061cafabd..9c296e6ba6 100644
--- a/common/spec/dependabot/pull_request_creator/azure_spec.rb
+++ b/common/spec/dependabot/pull_request_creator/azure_spec.rb
@@ -192,7 +192,7 @@
)
end
- context "but are an empty hash" do
+ context "when there is an empty hash" do
let(:author_details) { {} }
it "does not include the author details in the commit" do
@@ -224,7 +224,7 @@
)
end
- context "but a pull request to this branch doesn't" do
+ context "when a pull request to this branch doesn't exist" do
before do
stub_request(
:get,
@@ -255,7 +255,7 @@
end
end
- context "and a pull request to this branch already exists" do
+ context "when a pull request to this branch already exists" do
before do
stub_request(
:get,
diff --git a/common/spec/dependabot/pull_request_creator/branch_namer/dependency_group_strategy_spec.rb b/common/spec/dependabot/pull_request_creator/branch_namer/dependency_group_strategy_spec.rb
index e05a96fd0f..da0ed77d08 100644
--- a/common/spec/dependabot/pull_request_creator/branch_namer/dependency_group_strategy_spec.rb
+++ b/common/spec/dependabot/pull_request_creator/branch_namer/dependency_group_strategy_spec.rb
@@ -200,7 +200,7 @@
end
end
- context "for files in a non-root directory" do
+ context "when dealing with files in a non-root directory" do
let(:directory) { "rails app/" } # let's make sure we deal with spaces too
let(:target_branch) { "" }
let(:separator) { "/" }
@@ -210,7 +210,7 @@
end
end
- context "targeting a branch" do
+ context "when dealing with the files targeting a branch" do
let(:directory) { "/" }
let(:target_branch) { "develop" }
let(:separator) { "/" }
@@ -220,7 +220,7 @@
end
end
- context "for files in a non-root directory targeting a branch" do
+ context "when dealing with files in a non-root directory targeting a branch" do
let(:directory) { "rails-app/" }
let(:target_branch) { "develop" }
let(:separator) { "_" }
diff --git a/common/spec/dependabot/pull_request_creator/branch_namer/solo_strategy_spec.rb b/common/spec/dependabot/pull_request_creator/branch_namer/solo_strategy_spec.rb
index bfd4da605c..dd3698d7e6 100644
--- a/common/spec/dependabot/pull_request_creator/branch_namer/solo_strategy_spec.rb
+++ b/common/spec/dependabot/pull_request_creator/branch_namer/solo_strategy_spec.rb
@@ -63,7 +63,7 @@
it { is_expected.to eq("dependabot/dummy/directory/business-1.5.0") }
- context "that starts with a dot" do
+ context "when the directory name starts with a dot" do
let(:directory) { ".directory" }
it "sanitizes the dot" do
@@ -174,7 +174,7 @@
it { is_expected.to eq("dependabot/dummy/multi-fc93691fd4") }
- context "for a java property update" do
+ context "when dealing with a java property update" do
let(:files) { [pom] }
let(:pom) do
Dependabot::DependencyFile.new(name: "pom.xml", content: pom_content)
@@ -233,7 +233,7 @@
end
end
- context "for a dependency set update" do
+ context "when dealing with a dependency set update" do
let(:dependencies) { [dependency, dep2] }
let(:dependency) do
Dependabot::Dependency.new(
@@ -422,7 +422,7 @@
it { is_expected.to eq("dependabot/dummy/business-tw-1.5.0") }
- context "that has a trailing dot" do
+ context "when there is a trailing dot" do
let(:requirement_string) { "^7." }
it { is_expected.to eq("dependabot/dummy/business-tw-7") }
@@ -467,7 +467,7 @@
expect(new_branch_name).to eq("dependabot/dummy/business-cff701b")
end
- context "due to a ref change" do
+ context "when there is a ref change" do
let(:new_ref) { "v1.1.0" }
let(:old_ref) { "v1.0.0" }
@@ -475,7 +475,7 @@
expect(new_branch_name).to eq("dependabot/dummy/business-v1.1.0")
end
- context "for a library" do
+ context "when dealing with a library" do
let(:new_version) { nil }
let(:previous_version) { nil }
@@ -521,7 +521,7 @@
expect(new_branch_name).to eq("dependabot/docker/ubuntu-1830542")
end
- context "due to a tag change" do
+ context "when there is a tag change" do
let(:previous_version) { "17.04" }
it "includes the tag rather than the SHA" do
diff --git a/common/spec/dependabot/pull_request_creator/branch_namer_spec.rb b/common/spec/dependabot/pull_request_creator/branch_namer_spec.rb
index 98c0cf0f04..1bd5ae7f29 100644
--- a/common/spec/dependabot/pull_request_creator/branch_namer_spec.rb
+++ b/common/spec/dependabot/pull_request_creator/branch_namer_spec.rb
@@ -63,7 +63,7 @@
it { is_expected.to eq("dependabot/dummy/directory/business-1.5.0") }
- context "that starts with a dot" do
+ context "when the directory name starts with a dot" do
let(:directory) { ".directory" }
it "sanitizes the dot" do
@@ -174,7 +174,7 @@
it { is_expected.to eq("dependabot/dummy/multi-fc93691fd4") }
- context "for a java property update" do
+ context "when dealing with a java property update" do
let(:files) { [pom] }
let(:pom) do
Dependabot::DependencyFile.new(name: "pom.xml", content: pom_content)
@@ -233,7 +233,7 @@
end
end
- context "for a dependency set update" do
+ context "when dealing with a dependency set update" do
let(:dependencies) { [dependency, dep2] }
let(:dependency) do
Dependabot::Dependency.new(
@@ -422,7 +422,7 @@
it { is_expected.to eq("dependabot/dummy/business-tw-1.5.0") }
- context "that has a trailing dot" do
+ context "when there is a trailing dot" do
let(:requirement_string) { "^7." }
it { is_expected.to eq("dependabot/dummy/business-tw-7") }
@@ -467,7 +467,7 @@
expect(new_branch_name).to eq("dependabot/dummy/business-cff701b")
end
- context "due to a ref change" do
+ context "when there is a ref change" do
let(:new_ref) { "v1.1.0" }
let(:old_ref) { "v1.0.0" }
@@ -475,7 +475,7 @@
expect(new_branch_name).to eq("dependabot/dummy/business-v1.1.0")
end
- context "for a library" do
+ context "when dealing with a library" do
let(:new_version) { nil }
let(:previous_version) { nil }
@@ -521,7 +521,7 @@
expect(new_branch_name).to eq("dependabot/docker/ubuntu-1830542")
end
- context "due to a tag change" do
+ context "when there is a tag change" do
let(:previous_version) { "17.04" }
it "includes the tag rather than the SHA" do
diff --git a/common/spec/dependabot/pull_request_creator/github_spec.rb b/common/spec/dependabot/pull_request_creator/github_spec.rb
index 9d44197000..51374df9fb 100644
--- a/common/spec/dependabot/pull_request_creator/github_spec.rb
+++ b/common/spec/dependabot/pull_request_creator/github_spec.rb
@@ -411,7 +411,7 @@
expect { creator.create }.to raise_error(Octokit::UnprocessableEntity)
end
- context "because the branch is a superstring of another branch" do
+ context "when the branch is a superstring of another branch" do
before do
allow(SecureRandom).to receive(:hex).and_return("rand")
@@ -469,7 +469,7 @@
service_pack_response.gsub!("heads/rubocop", "heads/#{branch_name}")
end
- context "but a PR to this branch doesn't" do
+ context "when a PR to this branch doesn't exist" do
before do
url = "#{repo_api_url}/pulls?head=gocardless:#{branch_name}" \
"&state=all"
@@ -501,7 +501,7 @@
end
end
- context "and a PR to this branch already exists" do
+ context "when a PR to this branch already exists" do
before do
url = "#{repo_api_url}/pulls?head=gocardless:#{branch_name}" \
"&state=all"
@@ -515,7 +515,7 @@
expect(WebMock).to_not have_requested(:post, "#{repo_api_url}/pulls")
end
- context "but isn't initially returned (a race)" do
+ context "when the PR isn't initially returned (a race)" do
before do
url = "#{repo_api_url}/pulls?head=gocardless:#{branch_name}" \
"&state=all"
@@ -543,7 +543,7 @@
end
end
- context "but is merged" do
+ context "when the PR is merged" do
before do
url = "#{repo_api_url}/pulls?head=gocardless:#{branch_name}" \
"&state=all"
@@ -589,7 +589,7 @@
.to_not have_requested(:post, "#{repo_api_url}/pulls")
end
- context "and the commit we're branching off of is up-to-date" do
+ context "when the commit we're branching off of is up-to-date" do
let(:base_commit) { "7bb4e41ce5164074a0920d5b5770d196b4d90104" }
it "creates a PR" do
@@ -792,7 +792,7 @@
)
end
- context "that doesn't exist" do
+ context "when the PR doesn't exist" do
before do
stub_request(:post, "#{repo_api_url}/pulls")
.to_return(status: 422,
@@ -888,7 +888,7 @@
.with(body: '["wontfix"]')
end
- context "that doesn't exist" do
+ context "when the label doesn't exist" do
let(:custom_labels) { ["non-existent"] }
# Alternatively we could create the label (current choice isn't fixed)
@@ -939,7 +939,7 @@
).with(body: { reviewers: ["greysteil"], team_reviewers: [] }.to_json)
end
- context "that can't be added" do
+ context "when the reviewer can't be added" do
before do
stub_request(:post, "#{repo_api_url}/pulls/1347/requested_reviewers")
.to_return(status: 422,
@@ -994,7 +994,7 @@
.with(body: { assignees: ["greysteil"] }.to_json)
end
- context "and GitHub 404s" do
+ context "when GitHub returns a 404" do
before do
stub_request(:post, "#{repo_api_url}/issues/1347/assignees")
.to_return(status: 404)
@@ -1029,7 +1029,7 @@
).with(body: { milestone: 5 }.to_json)
end
- context "but can't be specified for some reason" do
+ context "when the milestone can't be specified for some reason" do
before do
stub_request(:patch, "#{repo_api_url}/issues/1347")
.to_return(status: 422,
diff --git a/common/spec/dependabot/pull_request_creator/gitlab_spec.rb b/common/spec/dependabot/pull_request_creator/gitlab_spec.rb
index dc34c29783..3c7c96ddec 100644
--- a/common/spec/dependabot/pull_request_creator/gitlab_spec.rb
+++ b/common/spec/dependabot/pull_request_creator/gitlab_spec.rb
@@ -368,7 +368,7 @@
)
end
- context "but a merge request to this branch doesn't" do
+ context "when a merge request to this branch doesn't exist" do
before do
stub_request(:get, "#{repo_api_url}/merge_requests")
.with(
@@ -380,7 +380,7 @@
).to_return(status: 200, body: "[]", headers: json_header)
end
- context "and the commit doesn't already exists on that branch" do
+ context "when the commit doesn't already exists on that branch" do
before do
stub_request(:get, "#{repo_api_url}/repository/commits")
.with(query: { ref_name: branch_name })
@@ -399,7 +399,7 @@
end
end
- context "and a commit already exists on that branch" do
+ context "when a commit already exists on that branch" do
before do
stub_request(:get, "#{repo_api_url}/repository/commits")
.with(query: { ref_name: branch_name })
@@ -419,7 +419,7 @@
end
end
- context "and a merge request to this branch already exists" do
+ context "when a merge request to this branch already exists" do
before do
stub_request(:get, "#{repo_api_url}/merge_requests")
.with(
diff --git a/common/spec/dependabot/pull_request_creator/labeler_spec.rb b/common/spec/dependabot/pull_request_creator/labeler_spec.rb
index 2e28af78e8..7eff59ab63 100644
--- a/common/spec/dependabot/pull_request_creator/labeler_spec.rb
+++ b/common/spec/dependabot/pull_request_creator/labeler_spec.rb
@@ -132,7 +132,7 @@
.to_not have_requested(:post, "#{repo_api_url}/labels")
end
- context "that is only present after paginating" do
+ context "when dealing with the label that is only present after paginating" do
let(:repo_labels_url) { "#{repo_api_url}/labels?per_page=100" }
let(:links_header) do
{
@@ -165,7 +165,7 @@
end
end
- context "that should be ignored" do
+ context "when considering the label that should be ignored" do
let(:labels_fixture_name) { "labels_with_custom_ignored.json" }
before do
@@ -287,7 +287,7 @@
end
end
- context "that doesn't exist" do
+ context "when the label is not exist" do
let(:custom_labels) { ["non-existent"] }
it "does not create any labels" do
@@ -299,7 +299,7 @@
end
end
- context "for an update that fixes a security vulnerability" do
+ context "when applying an update that fixes a security vulnerability" do
let(:includes_security_fixes) { true }
context "when the 'security' label doesn't yet exist" do
@@ -354,7 +354,7 @@
end
end
- context "for an update that fixes a security vulnerability" do
+ context "when applying an update that fixes a security vulnerability" do
let(:includes_security_fixes) { true }
context "when the 'security' label doesn't yet exist" do
@@ -443,7 +443,7 @@
.to_not have_requested(:post, "#{repo_api_url}/labels")
end
- context "that doesn't exist" do
+ context "when the label is not exist" do
let(:custom_labels) { ["non-existent"] }
it "does not create any labels" do
@@ -455,7 +455,7 @@
end
end
- context "for an update that fixes a security vulnerability" do
+ context "when applying an update that fixes a security vulnerability" do
let(:includes_security_fixes) { true }
context "when the 'security' label doesn't yet exist" do
@@ -521,7 +521,7 @@
it { is_expected.to eq(["dependencies"]) }
- context "for a security fix" do
+ context "when dealing with a security fix" do
let(:includes_security_fixes) { true }
let(:labels_fixture_name) { "labels_with_security.json" }
@@ -534,7 +534,7 @@
it { is_expected.to eq(["dependencies"]) }
- context "and label_language is true" do
+ context "when label_language is true" do
let(:label_language) { true }
it { is_expected.to match_array(%w(dependencies ruby)) }
@@ -558,7 +558,7 @@
it { is_expected.to eq(["wontfix"]) }
- context "that don't exist" do
+ context "when the label is not exist" do
let(:custom_labels) { ["non-existent"] }
it { is_expected.to eq([]) }
@@ -571,39 +571,39 @@
end
end
- context "for an automerge candidate" do
+ context "when dealing with an automerge candidate" do
let(:automerge_candidate) { true }
it { is_expected.to_not include("automerge") }
- context "for a repo that has an automerge label" do
+ context "when dealing with a repo that has an automerge label" do
let(:labels_fixture_name) { "labels_with_automerge_tag.json" }
it { is_expected.to include("automerge") }
end
end
- context "for a non-automerge candidate" do
+ context "when dealing with a non-automerge candidate" do
let(:automerge_candidate) { false }
- context "for a repo that has an automerge label" do
+ context "when dealing with a repo that has an automerge label" do
let(:labels_fixture_name) { "labels_with_automerge_tag.json" }
it { is_expected.to_not include("automerge") }
end
end
- context "for a repo without patch, minor and major labels" do
+ context "when dealing with a repo without patch, minor and major labels" do
it { is_expected.to_not include("patch") }
end
- context "for a repo that has patch, minor and major labels" do
+ context "when dealing with a repo that has patch, minor and major labels" do
let(:labels_fixture_name) { "labels_with_semver_tags.json" }
context "with a version and a previous version" do
let(:previous_version) { "1.4.0" }
- context "for a patch release" do
+ context "when dealing with a patch release" do
let(:version) { "1.4.1" }
it { is_expected.to include("patch") }
@@ -615,7 +615,7 @@
end
end
- context "for a patch release with build identifier" do
+ context "when dealing with a patch release with build identifier" do
let(:version) { "1.4.1+10" }
it { is_expected.to include("patch") }
@@ -627,7 +627,7 @@
end
end
- context "for a patch release when both have build identifiers" do
+ context "when dealing with a patch release and both have build identifiers" do
let(:previous_version) { "1.4.0+10" }
let(:version) { "1.4.1+9" }
@@ -640,51 +640,51 @@
end
end
- context "for a minor release" do
+ context "when dealing with a minor release" do
let(:version) { "1.5.1" }
it { is_expected.to include("minor") }
end
- context "for a minor release with build identifier" do
+ context "when dealing with a minor release with build identifier" do
let(:version) { "1.5.1+1" }
it { is_expected.to include("minor") }
end
- context "for a minor release when both have build identifiers" do
+ context "when dealing with a minor release when both have build identifiers" do
let(:previous_version) { "1.4.0+10" }
let(:version) { "1.5.1+1" }
it { is_expected.to include("minor") }
end
- context "for a major release" do
+ context "when dealing with a major release" do
let(:version) { "2.5.1" }
it { is_expected.to include("major") }
end
- context "for a major release with build identifier" do
+ context "when dealing with a major release with build identifier" do
let(:version) { "2.5.1+100" }
it { is_expected.to include("major") }
end
- context "for a major release when both have build identifiers" do
+ context "when dealing with a major release and both have build identifiers" do
let(:previous_version) { "1.4.0+10" }
let(:version) { "2.5.1+100" }
it { is_expected.to include("major") }
end
- context "for a non-semver release" do
+ context "when dealing with a non-semver release" do
let(:version) { "random" }
it { is_expected.to eq(["dependencies"]) }
end
- context "for a git dependency" do
+ context "when dealing with a git dependency" do
let(:version) { "6cf3d8c20aa5171b4f9f98ab8f4b6ced5ace912f" }
let(:previous_version) do
"9cd93a80d534ff616458af949b0d67aa10812d1a"
@@ -727,7 +727,7 @@
end
end
- context "for an update that fixes a security vulnerability" do
+ context "when applying an update that fixes a security vulnerability" do
let(:includes_security_fixes) { true }
context "when a default and custom dependencies label exists" do
@@ -748,7 +748,7 @@
context "when a 'dependencies' label exists" do
it { is_expected.to eq(["dependencies"]) }
- context "for a security fix" do
+ context "when applying a security fix" do
let(:includes_security_fixes) { true }
it { is_expected.to eq(%w(dependencies security)) }
@@ -764,7 +764,7 @@
it { is_expected.to eq(["critical"]) }
- context "that don't exist" do
+ context "when dealing with the labels that don't exist" do
let(:custom_labels) { ["non-existent"] }
it { is_expected.to eq(["non-existent"]) }
@@ -803,7 +803,7 @@
it { is_expected.to eq(["dependencies"]) }
- context "for a security fix" do
+ context "when dealing with a security fix" do
let(:includes_security_fixes) { true }
before do
@@ -858,7 +858,7 @@
it { is_expected.to eq(["critical"]) }
- context "that don't exist" do
+ context "when dealing with labels that don't exist" do
let(:custom_labels) { ["non-existent"] }
it { is_expected.to eq([]) }
@@ -952,7 +952,7 @@
end
end
- context "for a security fix" do
+ context "when dealing with a security fix" do
let(:includes_security_fixes) { true }
before do
diff --git a/common/spec/dependabot/pull_request_creator/message_builder/link_and_mention_sanitizer_spec.rb b/common/spec/dependabot/pull_request_creator/message_builder/link_and_mention_sanitizer_spec.rb
index 50292778a4..9a099501d0 100644
--- a/common/spec/dependabot/pull_request_creator/message_builder/link_and_mention_sanitizer_spec.rb
+++ b/common/spec/dependabot/pull_request_creator/message_builder/link_and_mention_sanitizer_spec.rb
@@ -26,7 +26,7 @@
"@\u200Bgreysteil
!
Great work @greysteil
!
Great work @greysteil
!
@model ||= 123