Sha256: 88c74e4e189f0c3abe1c88483e4f4324d60a175305c802eb0d407ebdfc8823b0

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

require 'spec_helper'

describe VagrantWindows::Communication::WinRMShell, :integration => true do
  
  before(:all) do
    port = (ENV['WINRM_PORT'] || 5985).to_i
    @shell = VagrantWindows::Communication::WinRMShell.new(
      "127.0.0.1", "vagrant", "vagrant", { port: port })
  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

  describe ".wql" do
    it "should return query results in stdout" do
      result = @shell.wql('SELECT * FROM Win32_NetworkAdapter WHERE MACAddress IS NOT NULL')
      expect(result[:win32_network_adapter]).to_not be_empty
    end
  end
 
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-windows-1.7.0.pre.2 spec/vagrant-windows/winrmshell_spec.rb