Sha256: 601eb3d15b2325c19a203ecf3b9b16266900affb112d68d6a1b287eb8b05b42d

Contents?: true

Size: 1.4 KB

Versions: 9

Compression:

Stored size: 1.4 KB

Contents

require File.expand_path("../../../base", __FILE__)

require "vagrant/util/platform"

describe Vagrant::Util::Platform do
  include_context "unit"

  subject { described_class }

  describe "#cygwin?" do
    before do
      allow(subject).to receive(:platform).and_return("test")
      described_class.reset!
    end

    after do
      described_class.reset!
    end

    around do |example|
      with_temp_env(VAGRANT_DETECTED_OS: "nope", PATH: "") do
        example.run
      end
    end

    it "returns true if VAGRANT_DETECTED_OS includes cygwin" do
      with_temp_env(VAGRANT_DETECTED_OS: "cygwin") do
        expect(subject).to be_cygwin
      end
    end

    it "returns true if platform has cygwin" do
      allow(subject).to receive(:platform).and_return("cygwin")
      expect(subject).to be_cygwin
    end

    it "returns true if the PATH contains cygwin" do
      with_temp_env(PATH: "C:/cygwin") do
        expect(subject).to be_cygwin
      end
    end

    it "returns false if nothing is available" do
      expect(subject).to_not be_cygwin
    end
  end

  describe "#fs_real_path" do
    it "fixes drive letters on Windows", :windows do
      expect(described_class.fs_real_path("c:/foo").to_s).to eql("C:/foo")
    end
  end

  describe "#windows_unc_path" do
    it "correctly converts a path" do
      expect(described_class.windows_unc_path("c:/foo").to_s).to eql("\\\\?\\c:\\foo")
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
vagrant-unbundled-1.9.1.1 test/unit/vagrant/util/platform_test.rb
vagrant-compose-yaml-0.1.3 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/test/unit/vagrant/util/platform_test.rb
vagrant-compose-yaml-0.1.2 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/test/unit/vagrant/util/platform_test.rb
vagrant-compose-yaml-0.1.1 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/test/unit/vagrant/util/platform_test.rb
vagrant-compose-yaml-0.1.0 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/test/unit/vagrant/util/platform_test.rb
vagrant-unbundled-1.8.5.2 test/unit/vagrant/util/platform_test.rb
vagrant-unbundled-1.8.5.1 test/unit/vagrant/util/platform_test.rb
vagrant-unbundled-1.8.4.2 test/unit/vagrant/util/platform_test.rb
vagrant-unbundled-1.8.4.1 test/unit/vagrant/util/platform_test.rb