diff options
| author | Markus Reiter | 2017-03-06 20:37:13 +0100 |
|---|---|---|
| committer | Markus Reiter | 2017-03-07 00:06:34 +0100 |
| commit | 3b8524d770172ec4aacb48fceb4dc8d2c1836bce (patch) | |
| tree | bf72cd1271b3f4ab8ea3f4b6e2ed122931f5cfa9 /Library/Homebrew/test | |
| parent | 1959cc3f2df6287467d90242fc6dee41398a5731 (diff) | |
| download | brew-3b8524d770172ec4aacb48fceb4dc8d2c1836bce.tar.bz2 | |
Refactor CLI options.
Diffstat (limited to 'Library/Homebrew/test')
| -rw-r--r-- | Library/Homebrew/test/cask/artifact/binary_spec.rb | 16 | ||||
| -rw-r--r-- | Library/Homebrew/test/cask/cli/options_spec.rb | 18 | ||||
| -rw-r--r-- | Library/Homebrew/test/cask/cli_spec.rb | 11 |
3 files changed, 29 insertions, 16 deletions
diff --git a/Library/Homebrew/test/cask/artifact/binary_spec.rb b/Library/Homebrew/test/cask/artifact/binary_spec.rb index 1b26773ca..e503a3ebb 100644 --- a/Library/Homebrew/test/cask/artifact/binary_spec.rb +++ b/Library/Homebrew/test/cask/artifact/binary_spec.rb @@ -47,15 +47,19 @@ describe Hbc::Artifact::Binary, :cask do end it "respects --no-binaries flag" do - Hbc.no_binaries = true + begin + Hbc::CLI.binaries = false - shutup do - Hbc::Artifact::Binary.new(cask).install_phase - end + expect(Hbc::CLI).not_to be_binaries - expect(expected_path.exist?).to be false + shutup do + Hbc::Artifact::Binary.new(cask).install_phase + end - Hbc.no_binaries = false + expect(expected_path.exist?).to be false + ensure + Hbc::CLI.binaries = true + end end it "creates parent directory if it doesn't exist" do diff --git a/Library/Homebrew/test/cask/cli/options_spec.rb b/Library/Homebrew/test/cask/cli/options_spec.rb index 86933e27e..35dafa853 100644 --- a/Library/Homebrew/test/cask/cli/options_spec.rb +++ b/Library/Homebrew/test/cask/cli/options_spec.rb @@ -122,17 +122,23 @@ describe Hbc::CLI, :cask do describe "--debug" do it "sets the Cask debug method to true" do - Hbc::CLI.process_options %w[help --debug] - expect(Hbc.debug).to be true - Hbc.debug = false + begin + Hbc::CLI.process_options %w[help --debug] + expect(Hbc::CLI.debug?).to be true + ensure + Hbc::CLI.debug = false + end end end describe "--help" do it "sets the Cask help method to true" do - Hbc::CLI.process_options %w[foo --help] - expect(Hbc.help).to be true - Hbc.help = false + begin + Hbc::CLI.process_options %w[foo --help] + expect(Hbc::CLI.help?).to be true + ensure + Hbc::CLI.help = false + end end end end diff --git a/Library/Homebrew/test/cask/cli_spec.rb b/Library/Homebrew/test/cask/cli_spec.rb index 1ad6790a3..0a4559ff2 100644 --- a/Library/Homebrew/test/cask/cli_spec.rb +++ b/Library/Homebrew/test/cask/cli_spec.rb @@ -32,10 +32,13 @@ describe Hbc::CLI, :cask do end it "prints help output when subcommand receives `--help` flag" do - expect(described_class).to receive(:run_command).with("help") - described_class.process(%w[noop --help]) - expect(Hbc.help).to eq(true) - Hbc.help = false + begin + expect(described_class).to receive(:run_command).with("help") + described_class.process(%w[noop --help]) + expect(Hbc::CLI.help?).to eq(true) + ensure + Hbc::CLI.help = false + end end it "respects the env variable when choosing what appdir to create" do |
