aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test
diff options
context:
space:
mode:
authorMarkus Reiter2017-05-19 21:48:21 +0200
committerMarkus Reiter2017-05-22 02:51:16 +0200
commit66e9a060dea952a23bb6f9b40d88f2571254be6a (patch)
tree6ecea103b37f14428303851f88c265e1d6d5dbd4 /Library/Homebrew/test
parent1f5828c72de87ce87df31fad1c1046a6bcf4a994 (diff)
downloadbrew-66e9a060dea952a23bb6f9b40d88f2571254be6a.tar.bz2
Refactor `CLI::Home`.
Diffstat (limited to 'Library/Homebrew/test')
-rw-r--r--Library/Homebrew/test/cask/cli/home_spec.rb41
1 files changed, 8 insertions, 33 deletions
diff --git a/Library/Homebrew/test/cask/cli/home_spec.rb b/Library/Homebrew/test/cask/cli/home_spec.rb
index 7be26dd4c..e985fb6cd 100644
--- a/Library/Homebrew/test/cask/cli/home_spec.rb
+++ b/Library/Homebrew/test/cask/cli/home_spec.rb
@@ -1,46 +1,21 @@
-# monkeypatch for testing
-module Hbc
- class CLI
- class Home
- def self.system(*command)
- system_commands << command
- end
-
- def self.reset!
- @system_commands = []
- end
-
- def self.system_commands
- @system_commands ||= []
- end
- end
- end
-end
-
describe Hbc::CLI::Home, :cask do
before do
- Hbc::CLI::Home.reset!
+ allow(described_class).to receive(:open_url)
end
it "opens the homepage for the specified Cask" do
- Hbc::CLI::Home.run("local-caffeine")
- expect(Hbc::CLI::Home.system_commands).to eq [
- ["/usr/bin/open", "--", "http://example.com/local-caffeine"],
- ]
+ expect(described_class).to receive(:open_url).with("http://example.com/local-caffeine")
+ described_class.run("local-caffeine")
end
it "works for multiple Casks" do
- Hbc::CLI::Home.run("local-caffeine", "local-transmission")
- expect(Hbc::CLI::Home.system_commands).to eq [
- ["/usr/bin/open", "--", "http://example.com/local-caffeine"],
- ["/usr/bin/open", "--", "http://example.com/local-transmission"],
- ]
+ expect(described_class).to receive(:open_url).with("http://example.com/local-caffeine")
+ expect(described_class).to receive(:open_url).with("http://example.com/local-transmission")
+ described_class.run("local-caffeine", "local-transmission")
end
it "opens the project page when no Cask is specified" do
- Hbc::CLI::Home.run
- expect(Hbc::CLI::Home.system_commands).to eq [
- ["/usr/bin/open", "--", "https://caskroom.github.io/"],
- ]
+ expect(described_class).to receive(:open_url).with("https://caskroom.github.io/")
+ described_class.run
end
end