diff options
| author | Markus Reiter | 2017-10-03 08:31:56 +0200 |
|---|---|---|
| committer | GitHub | 2017-10-03 08:31:56 +0200 |
| commit | ec0d8fa7ba18f4fe05c5241258502c8db332b13d (patch) | |
| tree | c688d2aac67813c920d8420788aa9d19a68552af /Library/Homebrew/test/cask | |
| parent | e3226638365713b7f9ea45f8a63322baa7dd1941 (diff) | |
| parent | 270bf0506a851af4748355791d1875207213466b (diff) | |
| download | brew-ec0d8fa7ba18f4fe05c5241258502c8db332b13d.tar.bz2 | |
Merge pull request #3220 from yzguy/yzguy/cask_available_languages_to_info
add available languages to cask info command
Diffstat (limited to 'Library/Homebrew/test/cask')
| -rw-r--r-- | Library/Homebrew/test/cask/cli/info_spec.rb | 32 | ||||
| -rw-r--r-- | Library/Homebrew/test/cask/dsl_spec.rb | 30 |
2 files changed, 62 insertions, 0 deletions
diff --git a/Library/Homebrew/test/cask/cli/info_spec.rb b/Library/Homebrew/test/cask/cli/info_spec.rb index aec7080de..df02bb1e5 100644 --- a/Library/Homebrew/test/cask/cli/info_spec.rb +++ b/Library/Homebrew/test/cask/cli/info_spec.rb @@ -90,6 +90,38 @@ describe Hbc::CLI::Info, :cask do EOS end + it "prints languages specified in the Cask" do + expect { + Hbc::CLI::Info.run("with-languages") + }.to output(<<-EOS.undent).to_stdout + with-languages: 1.2.3 + http://example.com/local-caffeine + Not installed + From: https://github.com/caskroom/homebrew-spec/blob/master/Casks/with-languages.rb + ==> Name + None + ==> Languages + zh, en-US + ==> Artifacts + Caffeine.app (App) + EOS + end + + it 'does not print "Languages" section divider if the languages block has no output' do + expect { + Hbc::CLI::Info.run("without-languages") + }.to output(<<-EOS.undent).to_stdout + without-languages: 1.2.3 + http://example.com/local-caffeine + Not installed + From: https://github.com/caskroom/homebrew-spec/blob/master/Casks/without-languages.rb + ==> Name + None + ==> Artifacts + Caffeine.app (App) + EOS + end + describe "when no Cask is specified" do it "raises an exception" do expect { diff --git a/Library/Homebrew/test/cask/dsl_spec.rb b/Library/Homebrew/test/cask/dsl_spec.rb index aec1e917f..7df8de6f8 100644 --- a/Library/Homebrew/test/cask/dsl_spec.rb +++ b/Library/Homebrew/test/cask/dsl_spec.rb @@ -177,6 +177,36 @@ describe Hbc::DSL, :cask do expect(cask.call.sha256).to eq("xyz789") expect(cask.call.url.to_s).to eq("https://example.org/en-US.zip") end + + it "returns an empty array if no languages are specified" do + cask = lambda do + Hbc::Cask.new("cask-with-apps") do + url "https://example.org/file.zip" + end + end + + expect(cask.call.languages).to be_empty + end + + it "returns an array of available languages" do + cask = lambda do + Hbc::Cask.new("cask-with-apps") do + language "zh" do + sha256 "abc123" + "zh-CN" + end + + language "en-US", default: true do + sha256 "xyz789" + "en-US" + end + + url "https://example.org/file.zip" + end + end + + expect(cask.call.languages).to eq(["zh", "en-US"]) + end end describe "app stanza" do |
