Sha256: d884e7eae1f3485f292f998fd3aafaf1e8e028f4aab1887a7417cd76aefa44ad

Contents?: true

Size: 1.11 KB

Versions: 22

Compression:

Stored size: 1.11 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')
        expect(subject.host_os).to eq('foo')
      end
    end

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

      it 'is identified as Linux' do
        expect(subject.linux?).to be(true)
      end

      it 'is not identified as OS X' do
        expect(subject.osx?).to be(false)
      end

      it 'locate is "locate"' do
        expect(Platform::Commands.locate).to 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
        expect(subject.linux?).to be(false)
      end

      it 'is identified as OS X' do
        expect(subject.osx?).to be(true)
      end

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

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
maid-0.9.0.alpha.2 spec/lib/maid/platform_spec.rb
maid-0.9.0.alpha.1 spec/lib/maid/platform_spec.rb
maid-0.8.0.alpha.4 spec/lib/maid/platform_spec.rb
maid-0.8.0.alpha.3 spec/lib/maid/platform_spec.rb
maid-0.8.0.alpha.2 spec/lib/maid/platform_spec.rb
maid-0.8.0.alpha.1 spec/lib/maid/platform_spec.rb
maid-0.7.0 spec/lib/maid/platform_spec.rb
maid-0.7.0.beta.1 spec/lib/maid/platform_spec.rb
maid-0.7.0.alpha.4 spec/lib/maid/platform_spec.rb
maid-0.7.0.alpha.2 spec/lib/maid/platform_spec.rb
maid-0.7.0.alpha.1 spec/lib/maid/platform_spec.rb
maid-0.6.1 spec/lib/maid/platform_spec.rb
maid-0.6.1.alpha.1 spec/lib/maid/platform_spec.rb
maid-0.6.0 spec/lib/maid/platform_spec.rb
maid-0.6.0.beta.2 spec/lib/maid/platform_spec.rb
maid-0.6.0.beta.1 spec/lib/maid/platform_spec.rb
maid-0.6.0.alpha.6 spec/lib/maid/platform_spec.rb
maid-0.6.0.alpha.5 spec/lib/maid/platform_spec.rb
maid-0.6.0.alpha.4 spec/lib/maid/platform_spec.rb
maid-0.6.0.alpha.3 spec/lib/maid/platform_spec.rb