Sha256: ed05b0c1330786e17b0bb98f1bb081d3dc22ccbb91acb9021cc2461c822f08fd

Contents?: true

Size: 1.49 KB

Versions: 11

Compression:

Stored size: 1.49 KB

Contents

require 'spec_helper'

describe VagrantWindows::Communication::WinRMFinder, :unit => true do

  before(:each) do
    @machine = stub()
    @winrmfinder = VagrantWindows::Communication::WinRMFinder.new(@machine)
  end

  describe 'winrm_host_address' do
    it 'should raise WinRMNotReady exception when ssh_info is nil' do
      @machine.stubs(:ssh_info).returns(nil)
      expect { @winrmfinder.winrm_host_address() }.to raise_error(VagrantWindows::Errors::WinRMNotReady)
    end
    
    it 'should return ssh_info host if config host has no value' do
      # setup the winrm config to return nil for the host (i.e. the default)
      winrm_config = VagrantWindows::Config::WinRM.new()
      winrm_config.finalize!()
      @machine.stubs(:winrm_config).returns(winrm_config)
      
      # setup the machine ssh_info to return a 10.0.0.1
      @machine.stubs(:ssh_info).returns({ :host => '10.0.0.1' })
      
      expect(@winrmfinder.winrm_host_address()).to eq('10.0.0.1')
    end
    
    it 'should return host config if set (issue 104)' do
      # setup the winrm config to return nil for the host (i.e. the default)
      winrm_config = VagrantWindows::Config::WinRM.new()
      winrm_config.host = '10.0.0.1'
      winrm_config.finalize!()
      @machine.stubs(:winrm_config).returns(winrm_config)
      
      # setup the machine ssh_info to return a 10.0.0.1
      @machine.stubs(:ssh_info).returns({ :host => '127.0.0.1' })
      
      expect(@winrmfinder.winrm_host_address()).to eq('10.0.0.1')
    end
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
vagrant-windows-1.7.0.pre.2 spec/vagrant-windows/winrmfinder_spec.rb
vagrant-windows-1.7.0.pre.1 spec/vagrant-windows/winrmfinder_spec.rb
vagrant-windows-1.6.0 spec/vagrant-windows/winrmfinder_spec.rb
vagrant-windows-1.6.0.pre.1 spec/vagrant-windows/winrmfinder_spec.rb
vagrant-windows-1.5.1 spec/vagrant-windows/winrmfinder_spec.rb
vagrant-windows-1.5.0 spec/vagrant-windows/winrmfinder_spec.rb
vagrant-windows-1.4.0 spec/vagrant-windows/winrmfinder_spec.rb
vagrant-windows-1.3.2 spec/vagrant-windows/winrmfinder_spec.rb
vagrant-windows-1.3.1 spec/vagrant-windows/winrmfinder_spec.rb
vagrant-windows-1.3.0 spec/vagrant-windows/winrmfinder_spec.rb
vagrant-windows-1.3.0.pre.3 spec/vagrant-windows/winrmfinder_spec.rb