diff options
| author | Markus Reiter | 2017-02-12 23:27:22 +0100 |
|---|---|---|
| committer | GitHub | 2017-02-12 23:27:22 +0100 |
| commit | cfc90af3cbdcc84c3aef0121cd00e89798bf28c8 (patch) | |
| tree | 1dc4e3bb2609a05d3add8f853d6da77b51cb6221 /Library/Homebrew/cask | |
| parent | 93724c0645f59ccdb4b4bf34f701957bacb5e45a (diff) | |
| parent | fd7616b8939e87423ab1785a0c0f17a44c92e571 (diff) | |
| download | brew-cfc90af3cbdcc84c3aef0121cd00e89798bf28c8.tar.bz2 | |
Merge pull request #1947 from reitermarkus/rubocop-constants
Use constants for RuboCop version.
Diffstat (limited to 'Library/Homebrew/cask')
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cli/style.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/cask/spec/cask/cli/style_spec.rb | 16 |
2 files changed, 17 insertions, 3 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cli/style.rb b/Library/Homebrew/cask/lib/hbc/cli/style.rb index cdcc135b8..d3e44382d 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/style.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/style.rb @@ -23,12 +23,10 @@ module Hbc $CHILD_STATUS.success? end - RUBOCOP_CASK_VERSION = "~> 0.10.6".freeze - def install_rubocop Utils.capture_stderr do begin - Homebrew.install_gem_setup_path! "rubocop-cask", RUBOCOP_CASK_VERSION, "rubocop" + Homebrew.install_gem_setup_path! "rubocop-cask", HOMEBREW_RUBOCOP_CASK_VERSION, "rubocop" rescue SystemExit raise CaskError, Tty.strip_ansi($stderr.string).chomp.sub(/\AError: /, "") end diff --git a/Library/Homebrew/cask/spec/cask/cli/style_spec.rb b/Library/Homebrew/cask/spec/cask/cli/style_spec.rb index b0d34576a..106bfbb44 100644 --- a/Library/Homebrew/cask/spec/cask/cli/style_spec.rb +++ b/Library/Homebrew/cask/spec/cask/cli/style_spec.rb @@ -1,4 +1,6 @@ require "English" +require "open3" +require "rubygems" describe Hbc::CLI::Style do let(:args) { [] } @@ -77,6 +79,20 @@ describe Hbc::CLI::Style do expect { subject }.to raise_error(Hbc::CaskError) end end + + context "version" do + it "matches `HOMEBREW_RUBOCOP_VERSION`" do + stdout, status = Open3.capture2("gem", "dependency", "rubocop-cask", "--version", HOMEBREW_RUBOCOP_CASK_VERSION, "--pipe", "--remote") + + expect(status).to be_a_success + + requirement = Gem::Requirement.new(stdout.scan(/rubocop --version '(.*)'/).flatten.first) + version = Gem::Version.new(HOMEBREW_RUBOCOP_VERSION) + + expect(requirement).not_to be_none + expect(requirement).to be_satisfied_by(version) + end + end end describe "#cask_paths" do |
