diff --git a/Library/.rubocop_rspec.yml b/Library/.rubocop_rspec.yml index 5a47d33451f31..aa6559e68c133 100644 --- a/Library/.rubocop_rspec.yml +++ b/Library/.rubocop_rspec.yml @@ -21,8 +21,6 @@ RSpec/MessageSpies: Enabled: false RSpec/RepeatedDescription: Enabled: false -RSpec/RepeatedExampleGroupDescription: - Enabled: false RSpec/StubbedMock: Enabled: false diff --git a/Library/Homebrew/test/download_strategies/curl_spec.rb b/Library/Homebrew/test/download_strategies/curl_spec.rb index 6ea5e5be0cb3b..09cd6ca07af5a 100644 --- a/Library/Homebrew/test/download_strategies/curl_spec.rb +++ b/Library/Homebrew/test/download_strategies/curl_spec.rb @@ -15,28 +15,6 @@ expect(strategy.send(:_curl_args)).to eq(["--user", "download:123456"]) end - describe "#cached_location" do - subject(:location) { described_class.new(url, name, version, **specs).cached_location } - - context "when URL ends with file" do - it { - expect(location).to eq( - HOMEBREW_CACHE/"downloads/3d1c0ae7da22be9d83fb1eb774df96b7c4da71d3cf07e1cb28555cf9a5e5af70--foo.tar.gz", - ) - } - end - - context "when URL file is in middle" do - let(:url) { "https://example.com/foo.tar.gz/from/this/mirror" } - - it { - expect(location).to eq( - HOMEBREW_CACHE/"downloads/1ab61269ba52c83994510b1e28dd04167a2f2e8393a35a9c50c1f7d33fd8f619--foo.tar.gz", - ) - } - end - end - describe "#fetch" do before do strategy.temporary_path.dirname.mkpath @@ -147,22 +125,48 @@ end describe "#cached_location" do + subject(:cached_location) { described_class.new(url, name, version, **specs).cached_location } + + context "when URL ends with file" do + it { + expect(cached_location).to eq( + HOMEBREW_CACHE/"downloads/3d1c0ae7da22be9d83fb1eb774df96b7c4da71d3cf07e1cb28555cf9a5e5af70--foo.tar.gz", + ) + } + end + + context "when URL file is in middle" do + let(:url) { "https://example.com/foo.tar.gz/from/this/mirror" } + + it { + expect(cached_location).to eq( + HOMEBREW_CACHE/"downloads/1ab61269ba52c83994510b1e28dd04167a2f2e8393a35a9c50c1f7d33fd8f619--foo.tar.gz", + ) + } + end + context "with a file name trailing the URL path" do let(:url) { "https://example.com/cask.dmg" } - its("cached_location.extname") { is_expected.to eq(".dmg") } + it { + expect(cached_location.extname).to eq(".dmg") + } end context "with a file name trailing the first query parameter" do let(:url) { "https://example.com/download?file=cask.zip&a=1" } - its("cached_location.extname") { is_expected.to eq(".zip") } + it { + expect(cached_location.extname).to eq(".zip") + } end context "with a file name trailing the second query parameter" do let(:url) { "https://example.com/dl?a=1&file=cask.zip&b=2" } - its("cached_location.extname") { is_expected.to eq(".zip") } + it { + expect(cached_location.extname).to eq(".zip") + } end context "with an unusually long query string" do @@ -184,8 +188,10 @@ ].join end - its("cached_location.extname") { is_expected.to eq(".zip") } - its("cached_location.to_path.length") { is_expected.to be_between(0, 255) } + it { + expect(cached_location.extname).to eq(".zip") + expect(cached_location.to_path.length).to be_between(0, 255) + } end end end diff --git a/Library/Homebrew/test/os/linux/formula_spec.rb b/Library/Homebrew/test/os/linux/formula_spec.rb index 6a38602109605..412284a9a540e 100644 --- a/Library/Homebrew/test/os/linux/formula_spec.rb +++ b/Library/Homebrew/test/os/linux/formula_spec.rb @@ -56,9 +56,7 @@ expect(f.class.stable.deps[1].name).to eq("hello_linux") expect(f.class.stable.deps[2]).to eq(nil) end - end - describe "#on_linux" do it "adds a patch on Linux only" do f = formula do homepage "https://brew.sh" @@ -81,9 +79,7 @@ expect(f.patchlist.first.strip).to eq(:p1) expect(f.patchlist.first.url).to eq("patch_linux") end - end - describe "#on_linux" do it "uses on_linux within a resource block" do f = formula do homepage "https://brew.sh" diff --git a/Library/Homebrew/test/os/mac/formula_spec.rb b/Library/Homebrew/test/os/mac/formula_spec.rb index f41812a072298..762d5b02af943 100644 --- a/Library/Homebrew/test/os/mac/formula_spec.rb +++ b/Library/Homebrew/test/os/mac/formula_spec.rb @@ -61,9 +61,7 @@ expect(f.class.stable.deps[1].name).to eq("hello_macos") expect(f.class.stable.deps[2]).to eq(nil) end - end - describe "#on_macos" do it "adds a patch on Mac only" do f = formula do homepage "https://brew.sh" @@ -86,9 +84,7 @@ expect(f.patchlist.first.strip).to eq(:p1) expect(f.patchlist.first.url).to eq("patch_macos") end - end - describe "#on_macos" do it "uses on_macos within a resource block" do f = formula do homepage "https://brew.sh"