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

cask/url: deprecate url do blocks. #18407

Merged
merged 1 commit into from
Sep 26, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Library/Homebrew/cask/url.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ def initialize(uri, dsl:, &block)
@uri = uri
@dsl = dsl
@block = block

odeprecated "cask `url do` blocks" if @block
end

sig { returns(T.any(T.any(URI::Generic, String), [T.any(URI::Generic, String), Hash])) }
Expand Down
60 changes: 0 additions & 60 deletions Library/Homebrew/test/cask/audit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -948,36 +948,6 @@ def tmp_cask(name, text)
end
end

describe "url checks" do
let(:only) { %w[unnecessary_verified missing_verified no_match] }

context "with a block" do
let(:cask_token) { "booby-trap" }

context "when loading the cask" do
it "does not evaluate the block" do
expect { cask }.not_to raise_error
end
end

context "when doing an offline audit" do
let(:online) { false }

it "does not evaluate the block" do
expect(run).not_to error_with(/Boom/)
end
end

context "when doing and online audit" do
let(:online) { true }

it "evaluates the block" do
expect(run).to error_with(/Boom/)
end
end
end
end

describe "token conflicts" do
let(:only) { ["token_conflicts"] }
let(:cask_token) { "with-binary" }
Expand Down Expand Up @@ -1171,36 +1141,6 @@ def tmp_cask(name, text)

it { is_expected.to error_with(/a homepage stanza is required/) }
end

context "when url is lazy" do
let(:strict) { true }
let(:cask_token) { "with-lazy" }
let(:cask) do
tmp_cask cask_token.to_s, <<~RUBY
cask '#{cask_token}' do
version '1.8.0_72,8.13.0.5'
sha256 '8dd95daa037ac02455435446ec7bc737b34567afe9156af7d20b2a83805c1d8a'
url do
['https://brew.sh/foo.zip', {referer: 'https://example.com', cookies: {'foo' => 'bar'}}]
end
name 'Audit'
desc 'Audit Description'
homepage 'https://brew.sh'
app 'Audit.app'
end
RUBY
end

it { is_expected.to pass }

it "receives a referer" do
expect(audit.cask.url.referer).to eq "https://example.com"
end

it "receives cookies" do
expect(audit.cask.url.cookies).to eq "foo" => "bar"
end
end
end
end
end

This file was deleted.

Loading