Sha256: 8f56f3a31e13aa2c6955797d4d1d0269cf39a3311b3430a8adee18ff3bc2f3b0

Contents?: true

Size: 1.11 KB

Versions: 4

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'

describe VagrantWindows::Communication::WinRMCommunicator, :integration => true do
  
  before(:all) do
    # This test requires you already have a running Windows Server 2008 R2 Vagrant VM
    # Not ideal, but you have to start somewhere
    @shell = VagrantWindows::Communication::WinRMShell.new("localhost", "vagrant", "vagrant")
    @communicator = VagrantWindows::Communication::WinRMCommunicator.new({})
    @communicator.set_winrmshell(@shell)
  end
  
  describe "execute" do
    it "should return 1 when error_check is false" do
      expect(@communicator.execute("exit 1", { :error_check => false })).to eq(1)
    end
    
    it "should raise WinRMExecutionError when error_check is true" do
      expect { @communicator.execute("exit 1") }.to raise_error(VagrantWindows::Errors::WinRMExecutionError)
    end
    
    it "should raise specified error type when specified and error_check is true" do
      opts = { :error_class => VagrantWindows::Errors::WinRMInvalidShell }
      expect { @communicator.execute("exit 1", opts) }.to raise_error(VagrantWindows::Errors::WinRMInvalidShell)
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vagrant-windows-1.3.0.pre.2 spec/vagrant-windows/winrmcommunicator_spec.rb
vagrant-windows-1.3.0.pre.1 spec/vagrant-windows/winrmcommunicator_spec.rb
vagrant-windows-1.2.3 spec/vagrant-windows/winrmcommunicator_spec.rb
vagrant-windows-1.2.2 spec/vagrant-windows/winrmcommunicator_spec.rb