Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Enable RSpec/LeakyConstantDeclaration" #14432

Merged
merged 1 commit into from Jan 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions Library/.rubocop_rspec.yml
Expand Up @@ -11,6 +11,8 @@ RSpec/SubjectStub:
# TODO: try to enable these
RSpec/DescribeClass:
Enabled: false
RSpec/LeakyConstantDeclaration:
Enabled: false
RSpec/MessageSpies:
Enabled: false
RSpec/StubbedMock:
Expand Down
3 changes: 0 additions & 3 deletions Library/Homebrew/test/exceptions_spec.rb
Expand Up @@ -89,12 +89,9 @@

let(:mod) do
Module.new do
# These are defined within an anonymous module to avoid polluting the global namespace.
# rubocop:disable RSpec/LeakyConstantDeclaration
class Bar < Requirement; end

class Baz < Formula; end
# rubocop:enable RSpec/LeakyConstantDeclaration
end
end

Expand Down
13 changes: 7 additions & 6 deletions Library/Homebrew/test/formula_free_port_spec.rb
Expand Up @@ -9,15 +9,16 @@ module Homebrew
include described_class

describe "#free_port" do
# IANA suggests user port from 1024 to 49151
# and dynamic port for 49152 to 65535
# http://www.iana.org/assignments/port-numbers
MIN_PORT = 1024
MAX_PORT = 65535

it "returns a free TCP/IP port" do
# IANA suggests user port from 1024 to 49151
# and dynamic port for 49152 to 65535
# http://www.iana.org/assignments/port-numbers
min_port = 1024
max_port = 65535
port = free_port

expect(port).to be_between(min_port, max_port)
expect(port).to be_between(MIN_PORT, MAX_PORT)
expect { TCPServer.new(port).close }.not_to raise_error
end
end
Expand Down
20 changes: 9 additions & 11 deletions Library/Homebrew/test/patching_spec.rb
Expand Up @@ -4,17 +4,15 @@
require "formula"

describe "patching" do
before do
stub_const("TESTBALL_URL", "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz")
stub_const("TESTBALL_PATCHES_URL", "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1-patches.tgz")
stub_const("PATCH_URL_A", "file://#{TEST_FIXTURE_DIR}/patches/noop-a.diff")
stub_const("PATCH_URL_B", "file://#{TEST_FIXTURE_DIR}/patches/noop-b.diff")
stub_const("PATCH_A_CONTENTS", File.read("#{TEST_FIXTURE_DIR}/patches/noop-a.diff").freeze)
stub_const("PATCH_B_CONTENTS", File.read("#{TEST_FIXTURE_DIR}/patches/noop-b.diff").freeze)
stub_const("APPLY_A", "noop-a.diff")
stub_const("APPLY_B", "noop-b.diff")
stub_const("APPLY_C", "noop-c.diff")
end
TESTBALL_URL = "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz"
TESTBALL_PATCHES_URL = "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1-patches.tgz"
PATCH_URL_A = "file://#{TEST_FIXTURE_DIR}/patches/noop-a.diff"
PATCH_URL_B = "file://#{TEST_FIXTURE_DIR}/patches/noop-b.diff"
PATCH_A_CONTENTS = File.read("#{TEST_FIXTURE_DIR}/patches/noop-a.diff").freeze
PATCH_B_CONTENTS = File.read("#{TEST_FIXTURE_DIR}/patches/noop-b.diff").freeze
APPLY_A = "noop-a.diff"
APPLY_B = "noop-b.diff"
APPLY_C = "noop-c.diff"

def formula(name = "formula_name", path: Formulary.core_path(name), spec: :stable, alias_path: nil, &block)
Class.new(Formula) {
Expand Down