Sha256: 8e2efcbba46d4b2474b5976b00ffcf7c3917557cb7ba00c18056a573a1fb8b68

Contents?: true

Size: 1.08 KB

Versions: 9

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

describe VagrantWindows::Communication::WinRMShell, :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("127.0.0.1", "vagrant", "vagrant")
  end
  
  describe "powershell" do
    it "should return exit code of 0" do
      expect(@shell.powershell("exit 0")[:exitcode]).to eq(0)
    end
    
    it "should return exit code greater than 0" do
      expect(@shell.powershell("exit 1")[:exitcode]).to eq(1)
    end
    
    it "should return stdout" do
      result = @shell.powershell("dir") do |type, line|
        expect(type).to eq(:stdout)
        expect(line.length).to be > 1  
      end
      expect(result[:exitcode]).to eq(0)
    end
  end
  
  describe "cmd" do
    it "should return stdout" do
      result = @shell.cmd("dir") do |type, line|
        expect(type).to eq(:stdout)
        expect(line.length).to be > 1  
      end
      expect(result[:exitcode]).to eq(0)
    end
  end
 
end

Version data entries

9 entries across 9 versions & 1 rubygems

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