Fixes for Ruby 3
This commit is contained in:
parent
71f558229a
commit
af7d744af0
@ -28,12 +28,12 @@ module Cask
|
|||||||
].freeze
|
].freeze
|
||||||
|
|
||||||
def self.from_args(cask, **directives)
|
def self.from_args(cask, **directives)
|
||||||
new(cask, directives)
|
new(cask, **directives)
|
||||||
end
|
end
|
||||||
|
|
||||||
attr_reader :directives
|
attr_reader :directives
|
||||||
|
|
||||||
def initialize(cask, directives)
|
def initialize(cask, **directives)
|
||||||
directives.assert_valid_keys(*ORDERED_DIRECTIVES)
|
directives.assert_valid_keys(*ORDERED_DIRECTIVES)
|
||||||
|
|
||||||
super(cask, **directives)
|
super(cask, **directives)
|
||||||
|
|||||||
@ -333,7 +333,13 @@ module Cask
|
|||||||
# for artifacts with blocks that can't be loaded from the API
|
# for artifacts with blocks that can't be loaded from the API
|
||||||
send(key) {} # empty on purpose
|
send(key) {} # empty on purpose
|
||||||
else
|
else
|
||||||
send(key, *artifact[key])
|
args = artifact[key]
|
||||||
|
kwargs = if args.last.is_a?(Hash)
|
||||||
|
args.pop
|
||||||
|
else
|
||||||
|
{}
|
||||||
|
end
|
||||||
|
send(key, *args, **kwargs)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -62,7 +62,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
taps.each do |tap|
|
taps.each do |tap|
|
||||||
Homebrew.failed = true unless Readall.valid_tap?(tap, options)
|
Homebrew.failed = true unless Readall.valid_tap?(tap, **options)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -4,17 +4,15 @@ require "cli/named_args"
|
|||||||
|
|
||||||
def setup_unredable_formula(name)
|
def setup_unredable_formula(name)
|
||||||
error = FormulaUnreadableError.new(name, RuntimeError.new("testing"))
|
error = FormulaUnreadableError.new(name, RuntimeError.new("testing"))
|
||||||
allow(Formulary).to receive(:factory).with(name, {}).and_raise(error)
|
allow(Formulary).to receive(:factory).with(name, any_args).and_raise(error)
|
||||||
end
|
end
|
||||||
|
|
||||||
def setup_unredable_cask(name)
|
def setup_unredable_cask(name)
|
||||||
error = Cask::CaskUnreadableError.new(name, "testing")
|
error = Cask::CaskUnreadableError.new(name, "testing")
|
||||||
allow(Cask::CaskLoader).to receive(:load).with(name).and_raise(error)
|
allow(Cask::CaskLoader).to receive(:load).with(name, any_args).and_raise(error)
|
||||||
allow(Cask::CaskLoader).to receive(:load).with(name, config: nil).and_raise(error)
|
|
||||||
|
|
||||||
config = instance_double(Cask::Config)
|
config = instance_double(Cask::Config)
|
||||||
allow(Cask::Config).to receive(:from_args).and_return(config)
|
allow(Cask::Config).to receive(:from_args).and_return(config)
|
||||||
allow(Cask::CaskLoader).to receive(:load).with(name, config: config).and_raise(error)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe Homebrew::CLI::NamedArgs do
|
describe Homebrew::CLI::NamedArgs do
|
||||||
|
|||||||
@ -27,7 +27,10 @@ describe "brew irb" do
|
|||||||
.and not_to_output.to_stderr
|
.and not_to_output.to_stderr
|
||||||
.and be_a_success
|
.and be_a_success
|
||||||
|
|
||||||
expect(history_file).to exist
|
# TODO: newer Ruby only supports history saving in interactive sessions
|
||||||
|
# and not if you feed in data from a file or stdin like we are doing here.
|
||||||
|
# The test will need to be adjusted for this to work.
|
||||||
|
expect(history_file).to exist if RUBY_VERSION < "2.7"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -15,8 +15,7 @@ module Test
|
|||||||
allow(Formulary).to receive(:loader_for).and_call_original if call_original
|
allow(Formulary).to receive(:loader_for).and_call_original if call_original
|
||||||
|
|
||||||
loader = double(get_formula: formula)
|
loader = double(get_formula: formula)
|
||||||
allow(Formulary).to receive(:loader_for).with(ref, from: :keg, warn: false).and_return(loader)
|
allow(Formulary).to receive(:loader_for).with(ref, any_args).and_return(loader)
|
||||||
allow(Formulary).to receive(:loader_for).with(ref, {}).and_return(loader)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -296,12 +296,12 @@ describe TestRunnerFormula do
|
|||||||
|
|
||||||
context "when a formula has no dependents" do
|
context "when a formula has no dependents" do
|
||||||
it "returns an empty array" do
|
it "returns an empty array" do
|
||||||
expect(described_class.new(testball).dependents(current_system)).to eq([])
|
expect(described_class.new(testball).dependents(**current_system)).to eq([])
|
||||||
expect(described_class.new(xcode_helper).dependents(current_system)).to eq([])
|
expect(described_class.new(xcode_helper).dependents(**current_system)).to eq([])
|
||||||
expect(described_class.new(linux_kernel_requirer).dependents(current_system)).to eq([])
|
expect(described_class.new(linux_kernel_requirer).dependents(**current_system)).to eq([])
|
||||||
expect(described_class.new(old_non_portable_software).dependents(current_system)).to eq([])
|
expect(described_class.new(old_non_portable_software).dependents(**current_system)).to eq([])
|
||||||
expect(described_class.new(fancy_new_software).dependents(current_system)).to eq([])
|
expect(described_class.new(fancy_new_software).dependents(**current_system)).to eq([])
|
||||||
expect(described_class.new(needs_modern_compiler).dependents(current_system)).to eq([])
|
expect(described_class.new(needs_modern_compiler).dependents(**current_system)).to eq([])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -313,11 +313,11 @@ describe TestRunnerFormula do
|
|||||||
allow(Formula).to receive(:all).and_return([testball_user, recursive_testball_dependent])
|
allow(Formula).to receive(:all).and_return([testball_user, recursive_testball_dependent])
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
described_class.new(testball, eval_all: true).dependents(current_system).map(&:name),
|
described_class.new(testball, eval_all: true).dependents(**current_system).map(&:name),
|
||||||
).to eq(["testball_user"])
|
).to eq(["testball_user"])
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
described_class.new(testball_user, eval_all: true).dependents(current_system).map(&:name),
|
described_class.new(testball_user, eval_all: true).dependents(**current_system).map(&:name),
|
||||||
).to eq(["recursive_testball_dependent"])
|
).to eq(["recursive_testball_dependent"])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user