From 1d8372cbc86cb5391140e8b78b61de59496045f8 Mon Sep 17 00:00:00 2001 From: Seeker Date: Thu, 14 Jan 2021 18:55:31 -0800 Subject: [PATCH] rubocops/*: improve test descriptions --- .../test/rubocops/components_order_spec.rb | 20 +++++++---------- Library/Homebrew/test/rubocops/files_spec.rb | 4 ++-- .../Homebrew/test/rubocops/homepage_spec.rb | 2 +- Library/Homebrew/test/rubocops/lines_spec.rb | 22 +++++++++---------- .../Homebrew/test/rubocops/options_spec.rb | 2 +- .../Homebrew/test/rubocops/patches_spec.rb | 8 +++---- Library/Homebrew/test/rubocops/urls_spec.rb | 8 +++---- .../Homebrew/test/rubocops/version_spec.rb | 8 +++---- 8 files changed, 35 insertions(+), 39 deletions(-) diff --git a/Library/Homebrew/test/rubocops/components_order_spec.rb b/Library/Homebrew/test/rubocops/components_order_spec.rb index b95bda576f..f5f62207cc 100644 --- a/Library/Homebrew/test/rubocops/components_order_spec.rb +++ b/Library/Homebrew/test/rubocops/components_order_spec.rb @@ -6,7 +6,7 @@ require "rubocops/components_order" describe RuboCop::Cop::FormulaAudit::ComponentsOrder do subject(:cop) { described_class.new } - context "When auditing formula components order" do + context "when auditing formula components order" do it "reports and corrects an offense when `uses_from_macos` precedes `depends_on`" do expect_offense(<<~RUBY) class Foo < Formula @@ -337,8 +337,8 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do RUBY end - context "no on_os_block" do - it "does not fail when there is no on_os block" do + context "when formula has no OS-specific blocks" do + it "reports no offenses" do expect_no_offenses(<<~RUBY) class Foo < Formula homepage "https://brew.sh" @@ -352,8 +352,8 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do end end - context "on_os_block" do - it "correctly uses on_macos and on_linux blocks" do + context "when formula has OS-specific block(s)" do + it "reports no offenses when `on_macos` and `on_linux` are used correctly" do expect_no_offenses(<<~RUBY) class Foo < Formula homepage "https://brew.sh" @@ -400,10 +400,8 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do end RUBY end - end - context "on_macos_block" do - it "correctly uses as single on_macos block" do + it "reports no offenses when `on_macos` is used correctly" do expect_no_offenses(<<~RUBY) class Foo < Formula homepage "https://brew.sh" @@ -418,10 +416,8 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do end RUBY end - end - context "on_linux_block" do - it "correctly uses as single on_linux block" do + it "reports no offenses when `on_linux` is used correctly" do expect_no_offenses(<<~RUBY) class Foo < Formula homepage "https://brew.sh" @@ -516,7 +512,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do RUBY end - it "reports no offenses for a valid `on_macos` and `on_linux` block with versions" do + it "reports no offenses for a valid `on_macos` and `on_linux` block (with `version`)" do expect_no_offenses(<<~RUBY) class Foo < Formula homepage "https://brew.sh" diff --git a/Library/Homebrew/test/rubocops/files_spec.rb b/Library/Homebrew/test/rubocops/files_spec.rb index 746b4212b7..e59550f692 100644 --- a/Library/Homebrew/test/rubocops/files_spec.rb +++ b/Library/Homebrew/test/rubocops/files_spec.rb @@ -6,8 +6,8 @@ require "rubocops/files" describe RuboCop::Cop::FormulaAudit::Files do subject(:cop) { described_class.new } - context "When auditing files" do - it "when the permissions are invalid" do + context "when auditing files" do + it "reports an offense when the permissions are invalid" do filename = Formulary.core_path("test_formula") File.open(filename, "w") do |file| FileUtils.chmod "-rwx", filename diff --git a/Library/Homebrew/test/rubocops/homepage_spec.rb b/Library/Homebrew/test/rubocops/homepage_spec.rb index 1458673a9c..023ac46318 100644 --- a/Library/Homebrew/test/rubocops/homepage_spec.rb +++ b/Library/Homebrew/test/rubocops/homepage_spec.rb @@ -6,7 +6,7 @@ require "rubocops/homepage" describe RuboCop::Cop::FormulaAudit::Homepage do subject(:cop) { described_class.new } - context "When auditing homepage" do + context "when auditing homepage" do it "reports an offense when there is no homepage" do expect_offense(<<~RUBY) class Foo < Formula diff --git a/Library/Homebrew/test/rubocops/lines_spec.rb b/Library/Homebrew/test/rubocops/lines_spec.rb index 3b11159129..fbd08fb2c4 100644 --- a/Library/Homebrew/test/rubocops/lines_spec.rb +++ b/Library/Homebrew/test/rubocops/lines_spec.rb @@ -62,7 +62,7 @@ end describe RuboCop::Cop::FormulaAudit::ClassInheritance do subject(:cop) { described_class.new } - context "auditing formula class inheritance" do + context "when auditing formula class inheritance" do it "reports an offense when not using spaces for class inheritance" do expect_offense(<<~RUBY, "/homebrew-core/Formula/foo.rb") class Foo