Mock the upload method of SCP and the run method of SSH by default to make testing easier.
This allows us to assume the methods are mocked by default so that we can just consentrate on what we are testing. This is probably a patch that needs to be submitted to Fog. Reviewed-by: Jeff McCune Signed-off-by: Dan Bode <[email protected]> --- spec/unit/puppet/cloudpack_spec.rb | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-) diff --git a/spec/unit/puppet/cloudpack_spec.rb b/spec/unit/puppet/cloudpack_spec.rb index 27aa94d..160cb9a 100644 --- a/spec/unit/puppet/cloudpack_spec.rb +++ b/spec/unit/puppet/cloudpack_spec.rb @@ -1,6 +1,33 @@ require 'spec_helper' require 'puppet/cloudpack' +module Fog + module SSH + class Mock + def run(commands) + commands.collect do |command| + Result.new(command) + end + end + class Result + attr_accessor :command, :stderr, :stdout, :status + def initialize(command) + @command = command + @stderr = command + @stdout = command + end + end + end + end + module SCP + class Mock + def upload(local_path, remote_path, upload_options = {}) + nil + end + end + end +end + describe Puppet::CloudPack do before(:all) { @stdout, $stdout = $stdout, StringIO.new(@buffer = '') } after(:all) { $stdout = @stdout } -- 1.7.5.4 -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
