Sha256: e26cc00677826b55aa989892692837752ead57dc930883c55ac32781cf900b96

Contents?: true

Size: 1.09 KB

Versions: 15

Compression:

Stored size: 1.09 KB

Contents

class MockIO < IO
  def initialize
  end

  methods.each do |meth|
    define_method(:meth) {}
  end

  def === other
    super other
  end
end

module MockNet
  class HTTP

    class Response
      class ResponseHash
        def []key
          { 'ok' => true, 'hostname' => 'pool' }
        end

      end

      def body
        ResponseHash.new
      end

    end

    class Post
      def initialize uri
        @uri = uri
      end

      def set_form_data hash

      end
    end

    class Delete
      def initialize uri
        @uri = uri
      end
    end
    
    def initialize host, port
      @host = host
      @port = port
    end

    def request req
      Response.new
    end
  end

end

class FakeHost
  attr_accessor :commands

  def initialize(options = {})
    @pe = options[:pe]
    @commands = []
  end

  def is_pe?
    @pe
  end

  def any_exec_result
    RSpec::Mocks::Mock.new('exec-result').as_null_object
  end

  def exec(command, options = {})
    commands << command
    any_exec_result
  end

  def command_strings
    commands.map { |c| [c.command, c.args].join(' ') }
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
beaker-1.7.0 spec/mocks.rb
beaker-1.6.2 spec/mocks.rb
beaker-1.6.1 spec/mocks.rb
beaker-1.6.0 spec/mocks.rb
beaker-1.5.0 spec/mocks.rb
beaker-1.4.1 spec/mocks.rb
beaker-1.4.0 spec/mocks.rb
beaker-1.3.2 spec/mocks.rb
beaker-1.3.1 spec/mocks.rb
beaker-1.3.0 spec/mocks.rb
beaker-1.2.0 spec/mocks.rb
beaker-1.1.0 spec/mocks.rb
beaker-1.0.1 spec/mocks.rb
beaker-1.0.1.pre spec/mocks.rb
beaker-1.0.0 spec/mocks.rb