Sha256: 24add5d321acb4cc9f446d91e12f83684652c12781659ca57809f2a6b234c379

Contents?: true

Size: 1.06 KB

Versions: 9

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'
require 'natives/host_detection/package_provider'

describe Natives::HostDetection::PackageProvider do
  it "detects host's package provider name" do
    platform = double()
    platform.should_receive(:name).and_return('ubuntu')

    package_provider = Natives::HostDetection::PackageProvider.new(platform)

    expect(package_provider.name).to eq('apt')
  end

  it "returns first package provider that exists in host" do
    platform = double()
    package_provider = Natives::HostDetection::PackageProvider.new(platform)
    platform.should_receive(:name).and_return('mac_os_x')
    package_provider.should_receive(:which).with('brew').and_return(nil)
    package_provider.should_receive(:which).
      with('port').and_return('/path/to/port')

    expect(package_provider.name).to eq('macports')
  end

  it "returns nil when detection fails" do
    platform = double()
    platform.should_receive(:name).and_return('unknown')

    package_provider = Natives::HostDetection::PackageProvider.new(platform)

    expect(package_provider.name).to be_nil
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
natives-0.6.2 spec/natives/host_detection/package_provider_spec.rb
natives-0.6.1 spec/natives/host_detection/package_provider_spec.rb
natives-0.6.0 spec/natives/host_detection/package_provider_spec.rb
natives-0.5.5 spec/natives/host_detection/package_provider_spec.rb
natives-0.5.4 spec/natives/host_detection/package_provider_spec.rb
natives-0.5.3 spec/natives/host_detection/package_provider_spec.rb
natives-0.5.2 spec/natives/host_detection/package_provider_spec.rb
natives-0.5.1 spec/natives/host_detection/package_provider_spec.rb
natives-0.5.0 spec/natives/host_detection/package_provider_spec.rb