forked from Homebrew/homebrew-cask
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli_spec.rb
51 lines (45 loc) · 1.4 KB
/
cli_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
require 'spec_helper'
describe Cask::CLI do
it "lists the taps for casks that show up in two taps" do
listing = Cask::CLI.nice_listing(%w[
caskroom/cask/adium
caskroom/cask/google-chrome
passcod/homebrew-cask/adium
])
expect(listing).to eq(%w[
caskroom/cask/adium
google-chrome
passcod/cask/adium
])
end
describe ".process" do
let(:noop_command) { double('CLI::Noop') }
before {
allow(Cask::CLI).to receive(:lookup_command) { noop_command }
allow(noop_command).to receive(:run)
}
it "respects the env variable when choosing what appdir to create" do
with_env_var('HOMEBREW_CASK_OPTS', "--appdir=/custom/appdir") do
allow(Cask).to receive(:init) {
expect(Cask.appdir.to_s).to eq('/custom/appdir')
}
Cask::CLI.process('noop')
end
end
it "respects the ENV variable when choosing a non-default Caskroom location" do
with_env_var 'HOMEBREW_CASK_OPTS', "--caskroom=/custom/caskdir" do
allow(Cask).to receive(:init) {
expect(Cask.caskroom.to_s).to eq('/custom/caskdir')
}
Cask::CLI.process('noop')
end
end
it "exits with a status of 1 when something goes wrong" do
Cask::CLI.expects(:exit).with(1)
Cask::CLI.expects(:lookup_command).raises(CaskError)
shutup {
Cask::CLI.process('noop')
}
end
end
end