mirror of
https://github.com/donl/homebrew-cask-versions.git
synced 2026-07-16 22:06:43 -06:00
* convert existing Cask:: namespace to Hbc:: * move Homebrew-fork code under Hbc:: * move freestanding classes such as Tty and TopologicalHash under Hbc:: * recast HOMEBREW_CASK_ constants as HBC_ * modify our Homebrew Formula for backward compatibility * devscripts and dev docs
58 lines
1.2 KiB
Ruby
58 lines
1.2 KiB
Ruby
require 'test_helper'
|
|
|
|
# monkeypatch for testing
|
|
class Hbc::CLI::Edit
|
|
def self.exec_editor(*command)
|
|
editor_commands << command
|
|
end
|
|
|
|
def self.reset!
|
|
@editor_commands = []
|
|
end
|
|
|
|
def self.editor_commands
|
|
@editor_commands ||= []
|
|
end
|
|
end
|
|
|
|
describe Hbc::CLI::Edit do
|
|
before do
|
|
Hbc::CLI::Edit.reset!
|
|
end
|
|
|
|
it 'opens the editor for the specified Cask' do
|
|
Hbc::CLI::Edit.run('alfred')
|
|
Hbc::CLI::Edit.editor_commands.must_equal [
|
|
[Hbc.path('alfred')]
|
|
]
|
|
end
|
|
|
|
it 'throws away additional arguments and uses the first' do
|
|
Hbc::CLI::Edit.run('adium', 'alfred')
|
|
Hbc::CLI::Edit.editor_commands.must_equal [
|
|
[Hbc.path('adium')]
|
|
]
|
|
end
|
|
|
|
it 'raises an exception when the Cask doesnt exist' do
|
|
lambda {
|
|
Hbc::CLI::Edit.run('notacask')
|
|
}.must_raise Hbc::CaskUnavailableError
|
|
end
|
|
|
|
describe "when no Cask is specified" do
|
|
it "raises an exception" do
|
|
lambda {
|
|
Hbc::CLI::Edit.run()
|
|
}.must_raise Hbc::CaskUnspecifiedError
|
|
end
|
|
end
|
|
|
|
describe "when no Cask is specified, but an invalid option" do
|
|
it "raises an exception" do
|
|
lambda {
|
|
Hbc::CLI::Edit.run('--notavalidoption')
|
|
}.must_raise Hbc::CaskUnspecifiedError
|
|
end
|
|
end
|
|
end
|