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

java_requirement: set cask attribute #6218

Merged
merged 1 commit into from Jun 10, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions Library/Homebrew/requirements/java_requirement.rb
Expand Up @@ -30,6 +30,7 @@ def suggestion
def initialize(tags = [])
@version = tags.shift if /^\d/ =~ tags.first
super(tags)
@cask = suggestion.token
end

def message
Expand Down
21 changes: 21 additions & 0 deletions Library/Homebrew/test/java_requirement_spec.rb
Expand Up @@ -105,4 +105,25 @@ def setup_java_with_version(version)
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