homebrew-cask-versions/test/cli/open_test.rb
phinze f866a18725 add brew cask open command
thanks to @passcod for original implementation on his fork

refs #72
2013-02-17 14:07:59 -06:00

41 lines
765 B
Ruby

require 'test_helper'
module RecordSystemCalls
def system(*command)
system_commands << command
end
def reset!
@system_commands = []
end
def system_commands
@system_commands ||= []
end
end
module Cask::CLI::Open
extend RecordSystemCalls
end
describe Cask::CLI::Open do
before do
Cask::CLI::Open.reset!
end
it 'opens the homepage for the specified cask' do
Cask::CLI::Open.run('alfred')
Cask::CLI::Open.system_commands.must_equal [
['open', 'http://www.alfredapp.com/']
]
end
it 'works for multiple casks' do
Cask::CLI::Open.run('alfred', 'adium')
Cask::CLI::Open.system_commands.must_equal [
['open', 'http://www.alfredapp.com/'],
['open', 'http://www.adium.im/']
]
end
end