Sha256: 46ea2c74007c0736cb1e3c421a1fa630ef6b0aed5271d44cda1057393ec7a25d

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 KB

Contents

require 'rubygems' if RUBY_VERSION < '1.9'
require File.dirname(__FILE__) + '/../lib/os' # load before sane
require 'sane'
require 'spec/autorun'

describe "OS" do

  it "has a windows? method" do
    if RUBY_PLATFORM =~ /mingw|mswin/
      assert OS.windows? == true
      assert OS.doze? == true
      assert OS.posix? == false
    else # ltodo jruby
      if RUBY_PLATFORM =~ /linux/
        assert OS.windows? == false
        assert OS.posix? == true
      end
    end
  end

  it "has a bits method" do
    if RUBY_PLATFORM =~ /mingw32/
       assert OS.bits == 32
    elsif RUBY_PLATFORM =~ /64/ # linux...
       assert OS.bits == 64 
    end
  end

  it "should know if you're on java" do
    if RUBY_PLATFORM == 'java'
      assert OS.java? == true # I want just this value...
    else
      assert OS.java? == false
    end
  end
  
  it "should have a ruby.exe method" do
    if OS.windows?
      assert OS.ruby_bin.include?('ruby.exe')
    else
      assert OS.ruby_bin.include?('ruby') && OS.ruby_bin.include?('/')
    end
  end
  
  it "should have a mac? method" do
    if RUBY_PLATFORM =~ /darwin/
      assert OS.mac?
    else
      assert !OS.mac?
    end
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
os-0.6.0 spec/spec.os.rb