diff --git a/Library/Homebrew/livecheck.rb b/Library/Homebrew/livecheck.rb index ebfcc7ec52..efdf5339fe 100644 --- a/Library/Homebrew/livecheck.rb +++ b/Library/Homebrew/livecheck.rb @@ -170,8 +170,8 @@ class Livecheck params( # URL to check for version information. url: T.any(String, Symbol), - post_form: T.nilable(T::Hash[T.any(String, Symbol), String]), - post_json: T.nilable(T::Hash[T.any(String, Symbol), String]), + post_form: T.nilable(T::Hash[Symbol, String]), + post_json: T.nilable(T::Hash[Symbol, String]), ).returns(T.nilable(T.any(String, Symbol))) } def url(url = T.unsafe(nil), post_form: nil, post_json: nil) diff --git a/Library/Homebrew/livecheck/strategy.rb b/Library/Homebrew/livecheck/strategy.rb index ca67feef36..d591a7b7e9 100644 --- a/Library/Homebrew/livecheck/strategy.rb +++ b/Library/Homebrew/livecheck/strategy.rb @@ -172,8 +172,8 @@ module Homebrew # @return [Array] sig { params( - post_form: T.nilable(T::Hash[T.any(String, Symbol), String]), - post_json: T.nilable(T::Hash[T.any(String, Symbol), String]), + post_form: T.nilable(T::Hash[Symbol, String]), + post_json: T.nilable(T::Hash[Symbol, String]), ).returns(T::Array[String]) } def self.post_args(post_form: nil, post_json: nil) diff --git a/Library/Homebrew/test/livecheck/strategy_spec.rb b/Library/Homebrew/test/livecheck/strategy_spec.rb index ddb3bde2f5..bb701e3b43 100644 --- a/Library/Homebrew/test/livecheck/strategy_spec.rb +++ b/Library/Homebrew/test/livecheck/strategy_spec.rb @@ -9,14 +9,6 @@ RSpec.describe Homebrew::Livecheck::Strategy do let(:redirection_url) { "https://brew.sh/redirection" } let(:post_hash) do - { - "empty" => "", - "boolean" => "true", - "number" => "1", - "string" => "a + b = c", - } - end - let(:post_hash_symbol_keys) do { empty: "", boolean: "true", @@ -154,7 +146,6 @@ RSpec.describe Homebrew::Livecheck::Strategy do describe "::post_args" do it "returns an array including `--data` and an encoded form data string" do expect(strategy.post_args(post_form: post_hash)).to eq(["--data", form_string]) - expect(strategy.post_args(post_form: post_hash_symbol_keys)).to eq(["--data", form_string]) # If both `post_form` and `post_json` are present, only `post_form` will # be used. @@ -163,7 +154,6 @@ RSpec.describe Homebrew::Livecheck::Strategy do it "returns an array including `--json` and a JSON string" do expect(strategy.post_args(post_json: post_hash)).to eq(["--json", json_string]) - expect(strategy.post_args(post_json: post_hash_symbol_keys)).to eq(["--json", json_string]) end it "returns an empty array if `post_form` value is blank" do diff --git a/Library/Homebrew/test/livecheck_spec.rb b/Library/Homebrew/test/livecheck_spec.rb index d213d227d6..e52fd76265 100644 --- a/Library/Homebrew/test/livecheck_spec.rb +++ b/Library/Homebrew/test/livecheck_spec.rb @@ -29,10 +29,10 @@ RSpec.describe Livecheck do let(:post_hash) do { - "empty" => "", - "boolean" => "true", - "number" => "1", - "string" => "a + b = c", + empty: "", + boolean: "true", + number: "1", + string: "a + b = c", } end diff --git a/docs/Brew-Livecheck.md b/docs/Brew-Livecheck.md index 65cd546248..90ffcbe58c 100644 --- a/docs/Brew-Livecheck.md +++ b/docs/Brew-Livecheck.md @@ -119,8 +119,8 @@ Some checks require making a `POST` request and that can be accomplished by addi ```ruby livecheck do url "https://example.com/download.php", post_form: { - "Name" => "", - "E-mail" => "", + Name: "", + "E-mail": "", } regex(/href=.*?example[._-]v?(\d+(?:\.\d+)+)\.t/i) end