Skip to content
Snippets Groups Projects
Unverified Commit 8529cf65 authored by Mike McQuaid's avatar Mike McQuaid Committed by GitHub
Browse files

Merge pull request #6218 from xu-cheng/java_requirement

java_requirement: set cask attribute
parents c95cf90e 2bd9b277
No related branches found
No related tags found
No related merge requests found
......@@ -30,6 +30,7 @@ class JavaRequirement < Requirement
def initialize(tags = [])
@version = tags.shift if /^\d/ =~ tags.first
super(tags)
@cask = suggestion.token
end
def message
......
......@@ -105,4 +105,25 @@ describe JavaRequirement do
end
end
end
describe "#suggestion" do
context "without specific version" do
its(:suggestion) { is_expected.to match(/brew cask install adoptopenjdk/) }
its(:cask) { is_expected.to eq("adoptopenjdk") }
end
context "with version 1.8" do
subject { described_class.new(%w[1.8]) }
its(:suggestion) { is_expected.to match(%r{brew cask install homebrew/cask-versions/adoptopenjdk8}) }
its(:cask) { is_expected.to eq("homebrew/cask-versions/adoptopenjdk8") }
end
context "with version 1.8+" do
subject { described_class.new(%w[1.8+]) }
its(:suggestion) { is_expected.to match(/brew cask install adoptopenjdk/) }
its(:cask) { is_expected.to eq("adoptopenjdk") }
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment