Make Homebrew::API::Versions#latest_cask_version tests macOS-only
This commit is contained in:
parent
186c839525
commit
e08d5f113c
@ -4,30 +4,21 @@
|
||||
require "api"
|
||||
|
||||
describe Homebrew::API::Versions do
|
||||
let(:versions_formulae_json) {
|
||||
<<~EOS
|
||||
{
|
||||
"foo":{"version":"1.2.3","revision":0},
|
||||
"bar":{"version":"1.2","revision":4}
|
||||
}
|
||||
EOS
|
||||
}
|
||||
let(:versions_casks_json) {
|
||||
<<~EOS
|
||||
{
|
||||
"foo":{"version":"1.2.3","versions":{}},
|
||||
"bar":{"version":"1.2.3","versions":{"#{MacOS.version.to_sym}":"1.2.0"}},
|
||||
"baz":{"version":"1.2.3","versions":{"test_os":"1.2.0"}}
|
||||
}
|
||||
EOS
|
||||
}
|
||||
|
||||
def mock_curl_output(stdout: "", success: true)
|
||||
curl_output = OpenStruct.new(stdout: stdout, success?: success)
|
||||
allow(Utils::Curl).to receive(:curl_output).and_return curl_output
|
||||
end
|
||||
|
||||
describe "::latest_formula_version" do
|
||||
let(:versions_formulae_json) {
|
||||
<<~EOS
|
||||
{
|
||||
"foo":{"version":"1.2.3","revision":0},
|
||||
"bar":{"version":"1.2","revision":4}
|
||||
}
|
||||
EOS
|
||||
}
|
||||
|
||||
it "returns the expected `PkgVersion` when the revision is 0" do
|
||||
mock_curl_output stdout: versions_formulae_json
|
||||
pkg_version = described_class.latest_formula_version("foo")
|
||||
@ -47,7 +38,17 @@ describe Homebrew::API::Versions do
|
||||
end
|
||||
end
|
||||
|
||||
describe "::latest_cask_version" do
|
||||
describe "::latest_cask_version", :needs_macos do
|
||||
let(:versions_casks_json) {
|
||||
<<~EOS
|
||||
{
|
||||
"foo":{"version":"1.2.3","versions":{}},
|
||||
"bar":{"version":"1.2.3","versions":{"#{MacOS.version.to_sym}":"1.2.0"}},
|
||||
"baz":{"version":"1.2.3","versions":{"test_os":"1.2.0"}}
|
||||
}
|
||||
EOS
|
||||
}
|
||||
|
||||
it "returns the expected `Version`" do
|
||||
mock_curl_output stdout: versions_casks_json
|
||||
version = described_class.latest_cask_version("foo")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user