Sha256: d8bbf4fca7e05019d8923a3eaa7383bc7579729363317067c270ef1eabe2d5a3

Contents?: true

Size: 941 Bytes

Versions: 9

Compression:

Stored size: 941 Bytes

Contents

require 'fog/libvirt'

shared_context 'libvirt' do
  include_context 'unit'

  let(:libvirt_context) { true                      }
  let(:id)              { 'dummy-vagrant_dummy'     }
  let(:connection)      { double('connection') }
  let(:domain)          { double('domain') }

  def connection_result(options = {})
    result = options.fetch(:result, nil)
    double('connection_result' => result)
  end

  before (:each) do
    # we don't want unit tests to ever run commands on the system; so we wire
    # in a double to ensure any unexpected messages raise exceptions
    stub_const('::Fog::Compute', connection)

    # drivers also call vm_exists? during init;
    allow(connection).to receive(:servers).with(kind_of(String))
      .and_return(connection_result(result: nil))

    # return some information for domain when needed
    allow(domain).to receive(:mac).and_return('9C:D5:53:F1:5A:E7')

    machine.stub(id: id)
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
vagrant-libvirt-0.1.2 spec/support/libvirt_context.rb
vagrant-libvirt-0.1.0 spec/support/libvirt_context.rb
vagrant-libvirt-0.0.45 spec/support/libvirt_context.rb
vagrant-libvirt-0.0.43 spec/support/libvirt_context.rb
vagrant-libvirt-0.0.42 spec/support/libvirt_context.rb
vagrant-libvirt-0.0.40 spec/support/libvirt_context.rb
vagrant-libvirt-0.0.39 spec/support/libvirt_context.rb
vagrant-libvirt-0.0.38 spec/support/libvirt_context.rb
vagrant-libvirt-0.0.37 spec/support/libvirt_context.rb