Sha256: f6f2341e82ba7b0486dc8bfd068b0ebb30bd931786a165e6617a5f02f06071f7

Contents?: true

Size: 1.15 KB

Versions: 24

Compression:

Stored size: 1.15 KB

Contents

require 'spec_helper'
require 'yaml'

describe Launchy::Detect::HostOsFamily do

  before do
    Launchy.reset_global_options
  end

  after do
    Launchy.reset_global_options
  end

  YAML::load( IO.read( File.expand_path( "../../tattle-host-os.yaml", __FILE__ ) ) )['host_os'].keys.sort.each do |os|
    it "OS family of #{os} is detected" do
      os_family = Launchy::Detect::HostOsFamily.detect( os )
      _(os_family).must_be_kind_of Launchy::Detect::HostOsFamily
    end
  end

  { 'mswin'  => :windows?,
    'darwin' => :darwin?,
    'linux'  => :nix?,
    'cygwin' => :cygwin? }.each_pair do |os, method|
    it "#{method} returns true for #{os} " do
      r = Launchy::Detect::HostOsFamily.detect( os ).send( method )
      _(r).must_equal true
    end
  end

  it "uses the global host_os overrides" do
    ENV['LAUNCHY_HOST_OS'] = "fake-os-2"
    _(lambda { Launchy::Detect::HostOsFamily.detect }).must_raise Launchy::Detect::HostOsFamily::NotFoundError
    ENV.delete('LAUNCHY_HOST_OS')
  end


  it "does not find an os of 'dos'" do
    _(lambda { Launchy::Detect::HostOsFamily.detect( 'dos' ) }).must_raise Launchy::Detect::HostOsFamily::NotFoundError
  end

end

Version data entries

24 entries across 15 versions & 2 rubygems

Version Path
launchy-3.0.0 spec/detect/host_os_family_spec.rb
launchy-2.5.2 spec/detect/host_os_family_spec.rb
tdiary-5.2.4 vendor/bundle/ruby/3.1.0/gems/launchy-2.5.0/spec/detect/host_os_family_spec.rb
tdiary-5.2.3 vendor/bundle/ruby/3.1.0/gems/launchy-2.5.0/spec/detect/host_os_family_spec.rb
tdiary-5.2.2 vendor/bundle/ruby/3.1.0/gems/launchy-2.5.0/spec/detect/host_os_family_spec.rb
tdiary-5.2.1 vendor/bundle/ruby/3.1.0/gems/launchy-2.5.0/spec/detect/host_os_family_spec.rb
tdiary-5.2.0 vendor/bundle/ruby/3.0.0/gems/launchy-2.5.0/spec/detect/host_os_family_spec.rb
tdiary-5.2.0 vendor/bundle/ruby/2.7.0/gems/launchy-2.5.0/spec/detect/host_os_family_spec.rb
tdiary-5.1.7 vendor/bundle/ruby/3.0.0/gems/launchy-2.5.0/spec/detect/host_os_family_spec.rb
tdiary-5.1.7 vendor/bundle/ruby/2.7.0/gems/launchy-2.5.0/spec/detect/host_os_family_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/2.7.0/gems/launchy-2.5.0/spec/detect/host_os_family_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/launchy-2.5.0/spec/detect/host_os_family_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/launchy-2.5.0/spec/detect/host_os_family_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/launchy-2.5.0/spec/detect/host_os_family_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/3.0.0/gems/launchy-2.5.0/spec/detect/host_os_family_spec.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/launchy-2.5.0/spec/detect/host_os_family_spec.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/launchy-2.5.0/spec/detect/host_os_family_spec.rb
tdiary-5.1.5 vendor/bundle/ruby/2.7.0/gems/launchy-2.5.0/spec/detect/host_os_family_spec.rb
tdiary-5.1.4 vendor/bundle/ruby/2.7.0/gems/launchy-2.5.0/spec/detect/host_os_family_spec.rb
tdiary-5.1.3 vendor/bundle/ruby/2.6.0/gems/launchy-2.5.0/spec/detect/host_os_family_spec.rb