mirror of
https://github.com/donl/homebrew-cask-versions.git
synced 2026-07-17 06:16:47 -06:00
- the vagrant cask is our guinea pig - works for me - only basic testing at the moment - i wanted to push something to get the gears turning on this it turns out the concept is pretty simple. specify a list of pkgs to install; borrow the patterns from linkables for that. then basically just run "sudo installer" refs #14
45 lines
848 B
Ruby
45 lines
848 B
Ruby
class Cask::FakeSystemCommand
|
|
def self.fake_response_for(command, response='')
|
|
@responses ||= {}
|
|
@responses[command] = response
|
|
end
|
|
|
|
def self.system_calls
|
|
@system_calls
|
|
end
|
|
|
|
def self.init
|
|
@responses = {}
|
|
end
|
|
|
|
def self.clear
|
|
@responses = {}
|
|
@system_calls = Hash.new(0)
|
|
end
|
|
|
|
def self.run(command)
|
|
@responses ||= {}
|
|
@system_calls ||= Hash.new(0)
|
|
unless @responses.key?(command)
|
|
fail("no response faked for #{command.inspect}, faked responses are: #{@responses.inspect}")
|
|
end
|
|
@system_calls[command] += 1
|
|
@responses[command].split("\n")
|
|
end
|
|
end
|
|
|
|
module FakeSystemCommandHooks
|
|
def before_setup
|
|
Cask::FakeSystemCommand.init
|
|
super
|
|
end
|
|
|
|
def after_teardown
|
|
super
|
|
Cask::FakeSystemCommand.clear
|
|
end
|
|
end
|
|
|
|
class MiniTest::Spec
|
|
include FakeSystemCommandHooks
|
|
end
|