2017-10-03 10:49:58 +02:00
|
|
|
require_relative "shared_examples/invalid_option"
|
|
|
|
|
2017-03-05 19:26:56 +01:00
|
|
|
describe Hbc::CLI::Home, :cask do
|
2016-08-18 22:11:42 +03:00
|
|
|
before do
|
2017-05-19 21:48:21 +02:00
|
|
|
allow(described_class).to receive(:open_url)
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
|
2017-10-03 10:49:58 +02:00
|
|
|
it_behaves_like "a command that handles invalid options"
|
|
|
|
|
2016-08-18 22:11:42 +03:00
|
|
|
it "opens the homepage for the specified Cask" do
|
2017-05-19 21:48:21 +02:00
|
|
|
expect(described_class).to receive(:open_url).with("http://example.com/local-caffeine")
|
|
|
|
described_class.run("local-caffeine")
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
it "works for multiple Casks" do
|
2017-05-19 21:48:21 +02:00
|
|
|
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")
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
it "opens the project page when no Cask is specified" do
|
2017-05-19 21:48:21 +02:00
|
|
|
expect(described_class).to receive(:open_url).with("https://caskroom.github.io/")
|
|
|
|
described_class.run
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
end
|