Merge pull request #14440 from dduugg/avoid-stub_const
Enable RSpec/LeakyConstantDeclaration
This commit is contained in:
commit
72f10e52c0
@ -11,8 +11,6 @@ RSpec/SubjectStub:
|
|||||||
# TODO: try to enable these
|
# TODO: try to enable these
|
||||||
RSpec/DescribeClass:
|
RSpec/DescribeClass:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
RSpec/LeakyConstantDeclaration:
|
|
||||||
Enabled: false
|
|
||||||
RSpec/MessageSpies:
|
RSpec/MessageSpies:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
RSpec/StubbedMock:
|
RSpec/StubbedMock:
|
||||||
|
|||||||
@ -89,9 +89,12 @@ describe "Exception" do
|
|||||||
|
|
||||||
let(:mod) do
|
let(:mod) do
|
||||||
Module.new 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 Bar < Requirement; end
|
||||||
|
|
||||||
class Baz < Formula; end
|
class Baz < Formula; end
|
||||||
|
# rubocop:enable RSpec/LeakyConstantDeclaration
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -9,16 +9,15 @@ module Homebrew
|
|||||||
include described_class
|
include described_class
|
||||||
|
|
||||||
describe "#free_port" do
|
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
|
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
|
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
|
expect { TCPServer.new(port).close }.not_to raise_error
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -4,22 +4,29 @@
|
|||||||
require "formula"
|
require "formula"
|
||||||
|
|
||||||
describe "patching" do
|
describe "patching" do
|
||||||
TESTBALL_URL = "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz"
|
let(:formula_subclass) {
|
||||||
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) {
|
Class.new(Formula) {
|
||||||
|
# These are defined within an anonymous class to avoid polluting the global namespace.
|
||||||
|
# rubocop:disable RSpec/LeakyConstantDeclaration
|
||||||
|
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"
|
||||||
|
# rubocop:enable RSpec/LeakyConstantDeclaration
|
||||||
|
|
||||||
url TESTBALL_URL
|
url TESTBALL_URL
|
||||||
sha256 TESTBALL_SHA256
|
sha256 TESTBALL_SHA256
|
||||||
class_eval(&block)
|
}
|
||||||
}.new(name, path, spec, alias_path: alias_path)
|
}
|
||||||
|
|
||||||
|
def formula(name = "formula_name", path: Formulary.core_path(name), spec: :stable, alias_path: nil, &block)
|
||||||
|
formula_subclass.class_eval(&block)
|
||||||
|
formula_subclass.new(name, path, spec, alias_path: alias_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
matcher :be_patched do
|
matcher :be_patched do
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user