brew/Library/Homebrew/test/cask/cli/home_spec.rb

47 lines
1.1 KiB
Ruby
Raw Normal View History

2016-08-18 22:11:42 +03:00
# monkeypatch for testing
2016-09-24 13:52:43 +02:00
module Hbc
class CLI
class Home
def self.system(*command)
system_commands << command
end
2016-08-18 22:11:42 +03:00
2016-09-24 13:52:43 +02:00
def self.reset!
@system_commands = []
end
2016-08-18 22:11:42 +03:00
2016-09-24 13:52:43 +02:00
def self.system_commands
@system_commands ||= []
end
end
2016-08-18 22:11:42 +03:00
end
end
2017-03-05 19:26:56 +01:00
describe Hbc::CLI::Home, :cask do
2016-08-18 22:11:42 +03:00
before do
Hbc::CLI::Home.reset!
end
it "opens the homepage for the specified Cask" do
2017-02-08 12:15:34 +01:00
Hbc::CLI::Home.run("local-caffeine")
expect(Hbc::CLI::Home.system_commands).to eq [
["/usr/bin/open", "--", "http://example.com/local-caffeine"],
2016-10-14 20:33:16 +02:00
]
2016-08-18 22:11:42 +03:00
end
it "works for multiple Casks" do
2017-02-08 12:15:34 +01:00
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"],
2016-10-14 20:33:16 +02:00
]
2016-08-18 22:11:42 +03:00
end
it "opens the project page when no Cask is specified" do
Hbc::CLI::Home.run
2017-02-08 12:15:34 +01:00
expect(Hbc::CLI::Home.system_commands).to eq [
["/usr/bin/open", "--", "https://caskroom.github.io/"],
2016-10-14 20:33:16 +02:00
]
2016-08-18 22:11:42 +03:00
end
end