Sha256: 068465d40e1e50bd056337bbedf0994c6bb465e2805c228153c691e19fbaa6b8

Contents?: true

Size: 1.47 KB

Versions: 5

Compression:

Stored size: 1.47 KB

Contents

require 'spec_helper'
require 'mocha/api'

describe VagrantWindows::Helper , :unit => true do
  
  class DummyHelper
    include VagrantWindows::Helper
  end
  
  before(:all) do
    @dummy = DummyHelper.new
  end

  describe "win_friendly_path" do
    it "should replace slashes with backslashes"  do
      @dummy.win_friendly_path('c:/tmp/dir').should eq('c:\\tmp\\dir')
    end
    
    it "should prepend c: drive if not drive specified" do
      @dummy.win_friendly_path('/tmp/dir').should eq('c:\\tmp\\dir')
    end
    
    it "should return nil if no path specified" do
      @dummy.win_friendly_path(nil).should be_nil
    end
  end
  
  describe "win_friendly_share_id" do
    it "should use share id if present" do
      @dummy.win_friendly_share_id('sharename').should eq('sharename')
    end
    
    it "should use last folder name in guest_path" do
      @dummy.win_friendly_share_id('/tmp/folder/sharename').should eq('tmp_folder_sharename')
    end

  end
  
  describe "is_vmware" do
    it "should be true for vmware_fusion" do
      machine = stub(:provider_name => :vmware_fusion)
      expect(@dummy.is_vmware(machine)).to be_true
    end
    
    it "should be true for vmware_workstation" do
      machine = stub(:provider_name => :vmware_workstation)
      expect(@dummy.is_vmware(machine)).to be_true
    end
    
    it "should be false for virtual_box" do
      machine = stub(:provider_name => :virtual_box)
      expect(@dummy.is_vmware(machine)).to be_false
    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

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