Sha256: c9b0f4a0c622b413be62eb0001cbcfb9c59c9f287f0cbc3a9d5dd7ce73adf5f7

Contents?: true

Size: 1.5 KB

Versions: 12

Compression:

Stored size: 1.5 KB

Contents

require 'spec_helper'

describe Chozo::Platform do
  subject { Chozo::Platform }

  before(:each) do
    @original = RbConfig::CONFIG['host_os']
  end

  after(:each) do
    RbConfig::CONFIG['host_os'] = @original
  end

  describe "::windows?" do
    it "returns true when 'host_os' config matches mswin" do
      RbConfig::CONFIG['host_os'] = 'mswin'

      subject.should be_windows
    end

    it "returns true when 'host_os' config matches mingw" do
      RbConfig::CONFIG['host_os'] = 'mingw'

      subject.should be_windows
    end

    it "returns true when 'host_os' config matches cygwin" do
      RbConfig::CONFIG['host_os'] = 'cygwin'

      subject.should be_windows
    end

    it "returns false when 'host_os' config does not match windows" do
      RbConfig::CONFIG['host_os'] = 'darwin11.3.0'

      subject.should_not be_windows
    end
  end

  describe "::osx?" do
    it "returns false when 'host_os' config does not match darwin" do
      RbConfig::CONFIG['host_os'] = 'mingw'

      subject.should_not be_osx
    end

    it "returns true when 'host_os' config matches darwin" do
      RbConfig::CONFIG['host_os'] = 'darwin'

      subject.should be_osx
    end
  end

  describe "::linux?" do
    it "returns false when 'host_os' config does not match linux" do
      RbConfig::CONFIG['host_os'] = 'mingw'

      subject.should_not be_linux
    end

    it "returns true when 'host_os' config matches linux" do
      RbConfig::CONFIG['host_os'] = 'linux'

      subject.should be_linux
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
chozo-0.6.1 spec/unit/chozo/platform_spec.rb
chozo-0.6.0 spec/unit/chozo/platform_spec.rb
chozo-0.5.0 spec/unit/chozo/platform_spec.rb
chozo-0.4.2 spec/unit/chozo/platform_spec.rb
chozo-0.4.1 spec/unit/chozo/platform_spec.rb
chozo-0.4.0 spec/unit/chozo/platform_spec.rb
chozo-0.3.0 spec/unit/chozo/platform_spec.rb
chozo-0.2.3 spec/unit/chozo/platform_spec.rb
chozo-0.2.2 spec/unit/chozo/platform_spec.rb
chozo-0.2.1 spec/unit/chozo/platform_spec.rb
chozo-0.2.0 spec/unit/chozo/platform_spec.rb
chozo-0.1.0 spec/unit/chozo/platform_spec.rb