diff options
| author | Markus Reiter | 2017-03-08 19:34:24 +0100 |
|---|---|---|
| committer | GitHub | 2017-03-08 19:34:24 +0100 |
| commit | 6ec55a93eb03e5ba682fb4f4d67728e7d79ac550 (patch) | |
| tree | 82b58d2d4d431f92157094a1d315b02e6c2041df /Library/Homebrew/test | |
| parent | 1675f1c95e397c9176db064fb2fccec96a1f86b8 (diff) | |
| parent | b24dc2268ade6356e28d912c715c33f12727ef98 (diff) | |
| download | brew-6ec55a93eb03e5ba682fb4f4d67728e7d79ac550.tar.bz2 | |
Merge pull request #2293 from reitermarkus/cask-version
Move `brew cask --version` into separate file.
Diffstat (limited to 'Library/Homebrew/test')
5 files changed, 18 insertions, 12 deletions
diff --git a/Library/Homebrew/test/cask/cli/--version_spec.rb b/Library/Homebrew/test/cask/cli/--version_spec.rb new file mode 100644 index 000000000..2e5737c9f --- /dev/null +++ b/Library/Homebrew/test/cask/cli/--version_spec.rb @@ -0,0 +1,13 @@ +describe Hbc::CLI::Version, :cask do + describe "::run" do + it "outputs the current Hombrew-Cask version" do + expect { described_class.run } + .to output(/\AHomebrew-Cask.*\d+\.\d+\.\d+/).to_stdout + .and not_to_output.to_stderr + end + + it "does not support arguments" do + expect { described_class.run(:foo, :bar) }.to raise_error(ArgumentError) + end + end +end diff --git a/Library/Homebrew/test/cask/cli/version_spec.rb b/Library/Homebrew/test/cask/cli/version_spec.rb deleted file mode 100644 index 2091496fc..000000000 --- a/Library/Homebrew/test/cask/cli/version_spec.rb +++ /dev/null @@ -1,9 +0,0 @@ -describe "brew cask --version", :cask do - it "respects the --version argument" do - expect { - expect { - Hbc::CLI::NullCommand.new("--version").run - }.not_to output.to_stderr - }.to output(Hbc.full_version).to_stdout - end -end diff --git a/Library/Homebrew/test/cask/cli_spec.rb b/Library/Homebrew/test/cask/cli_spec.rb index 0a4559ff2..0dac89b0e 100644 --- a/Library/Homebrew/test/cask/cli_spec.rb +++ b/Library/Homebrew/test/cask/cli_spec.rb @@ -27,8 +27,10 @@ describe Hbc::CLI, :cask do end it "passes `--version` along to the subcommand" do - expect(described_class).to receive(:run_command).with(noop_command, "--version") - described_class.process(%w[noop --version]) + version_command = double("CLI::Version") + allow(described_class).to receive(:lookup_command).with("--version").and_return(version_command) + expect(described_class).to receive(:run_command).with(version_command) + described_class.process(["--version"]) end it "prints help output when subcommand receives `--help` flag" do diff --git a/Library/Homebrew/test/spec_helper.rb b/Library/Homebrew/test/spec_helper.rb index c8e5cc0f8..2f6274fd1 100644 --- a/Library/Homebrew/test/spec_helper.rb +++ b/Library/Homebrew/test/spec_helper.rb @@ -112,4 +112,5 @@ RSpec.configure do |config| end end +RSpec::Matchers.define_negated_matcher :not_to_output, :output RSpec::Matchers.alias_matcher :have_failed, :be_failed diff --git a/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb b/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb index a82098a0e..b037068d2 100644 --- a/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb +++ b/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb @@ -1,6 +1,5 @@ require "open3" -RSpec::Matchers.define_negated_matcher :not_to_output, :output RSpec::Matchers.define_negated_matcher :be_a_failure, :be_a_success RSpec.shared_context "integration test" do |
