Sha256: 046c3d2113c1dc95320eb4c2a3dac14d80d33feb548c2b578a9a1b63ae16ea46

Contents?: true

Size: 912 Bytes

Versions: 3

Compression:

Stored size: 912 Bytes

Contents

require 'spec_helper'

describe Launchy::Detect::NixDesktopEnvironment do

  before do
    Launchy.reset_global_options
  end

  after do
    Launchy.reset_global_options
  end


  { "KDE_FULL_SESSION"         => Launchy::Detect::NixDesktopEnvironment::Kde,
    "GNOME_DESKTOP_SESSION_ID" => Launchy::Detect::NixDesktopEnvironment::Gnome }.each_pair do |k,v|
    it "can detect the desktop environment of a *nix machine using ENV[#{k}]" do
      ENV[k] = "launchy-test"
      nix_env = Launchy::Detect::NixDesktopEnvironment.detect
      nix_env.must_equal( v )
      nix_env.browser.must_equal( v.browser )
      ENV.delete( k )
    end
   end


  it "returns nil if it cannot determine the *nix desktop environment" do
    Launchy.host_os = "linux"
    ENV.delete( "KDE_FULL_SESSION" )
    ENV.delete( "GNOME_DESKTOP_SESSION_ID" )
    Launchy::Detect::NixDesktopEnvironment.detect.must_equal( nil )
  end

end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
launchy-2.0.5-java spec/detect/nix_desktop_environment_spec.rb
wijet-launchy-2.0.6 spec/detect/nix_desktop_environment_spec.rb
launchy-2.0.5 spec/detect/nix_desktop_environment_spec.rb