Sha256: 9f76a52f66adf5cbf8bce0f805013bb4c5d171b98a2ffe5c9ea7bbe3e9ae8d00

Contents?: true

Size: 1.07 KB

Versions: 10

Compression:

Stored size: 1.07 KB

Contents

require 'spec_helper'

module Maid
  describe Platform do
    def stub_host_os(value)
      RbConfig::CONFIG.stub(:[]).with('host_os') { value }
    end

    describe 'determining the host OS' do
      it 'delegates to RbConfig' do
        stub_host_os('foo')
        subject.host_os.should == 'foo'
      end
    end

    context 'when running on Ubuntu' do
      before do
        stub_host_os('linux-gnu')
      end

      it 'is identified as Linux' do
        subject.linux?.should be_true
      end

      it 'is not identified as OS X' do
        subject.osx?.should be_false
      end

      it 'locate is "locate"' do
        Platform::Commands.locate.should match(/locate/)
      end
    end

    context 'when running on Mac OS X' do
      before do
        stub_host_os('darwin10.0')
      end

      it 'is not identified as Linux' do
        subject.linux?.should be_false
      end

      it 'is identified as OS X' do
        subject.osx?.should be_true
      end

      it 'locate is "mdfind"' do
        Platform::Commands.locate.should match(/mdfind/)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
maid-0.5.0 spec/lib/maid/platform_spec.rb
maid-0.4.2 spec/lib/maid/platform_spec.rb
maid-0.5.0.alpha.1 spec/lib/maid/platform_spec.rb
maid-0.4.1 spec/lib/maid/platform_spec.rb
maid-0.4.0 spec/lib/maid/platform_spec.rb
maid-0.4.0.beta.2 spec/lib/maid/platform_spec.rb
maid-0.4.0.beta.1 spec/lib/maid/platform_spec.rb
maid-0.4.0.alpha.2 spec/lib/maid/platform_spec.rb
maid-0.4.0.alpha.1 spec/lib/maid/platform_spec.rb
maid-0.2.3.alpha.1 spec/lib/maid/platform_spec.rb