Sha256: 30cadef2bee01cbcdfbf912c1bd56f28d8ae2fb671fb0888053a879e5c83176a

Contents?: true

Size: 1.19 KB

Versions: 4

Compression:

Stored size: 1.19 KB

Contents

require 'spec_helper'

describe Launchy::Application::Browser do
  before do
    Launchy.reset_global_options
    ENV['KDE_FULL_SESSION'] = "launchy"
    @test_url = "http://example.com/"
  end

  after do
    Launchy.reset_global_options
    ENV.delete( 'KDE_FULL_SESSION' )
  end

  { 'windows' => 'start "Launchy" /d' ,
    'darwin'  => '/usr/bin/open',
    'cygwin'  => 'cmd /C start "Launchy" /d',

    # when running these tests on a linux box, this test will fail
    'linux'   => nil                 }.each  do |host_os, cmdline|
    it "when host_os is '#{host_os}' the appropriate 'app_list' method is called" do
      Launchy.host_os = host_os
      browser = Launchy::Application::Browser.new
      browser.app_list.first.must_equal cmdline
    end
  end

  %w[ linux windows darwin cygwin ].each do |host_os|
    it "the BROWSER environment variable overrides any host defaults on '#{host_os}'" do
      ENV['BROWSER'] = "my_special_browser --new-tab '%s'"
      Launchy.host_os = host_os
      browser = Launchy::Application::Browser.new
      cmd, args = browser.cmd_and_args( @test_url )
      cmd.must_equal "my_special_browser --new-tab 'http://example.com/'"
      args.must_equal []
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
launchy-2.0.3-java spec/applications/browser_spec.rb
launchy-2.0.3 spec/applications/browser_spec.rb
launchy-2.0.2-java spec/applications/browser_spec.rb
launchy-2.0.2 spec/applications/browser_spec.rb