Sha256: b0f52f50880a95d8761bcda4bc109e66d1ba800d65c294c13e5995b85d3a6001
Contents?: true
Size: 1.64 KB
Versions: 2
Compression:
Stored size: 1.64 KB
Contents
require File.join(File.dirname(__FILE__),"spec_helper.rb") require 'stringio' describe Launchy::Browser do it "should find a path to a executable" do File.executable?(Launchy::Browser.new.browser).should == true end it "should handle an http url" do Launchy::Browser.handle?("http://www.example.com").should == true end it "should handle an https url" do Launchy::Browser.handle?("https://www.example.com").should == true end it "should handle an ftp url" do Launchy::Browser.handle?("ftp://download.example.com").should == true end it "should not handle a mailto url" do Launchy::Browser.handle?("mailto:jeremy@example.com").should == false end it "creates a default unix application list" do Launchy::Browser.new.nix_app_list.class.should == Array end it "can use environmental variable overrides for the browser" do { "BROWSER" => "/usr/bin/true", "LAUNCHY_BROWSER" => "/usr/bin/true"}.each_pair do |e,v| ENV[e] = v Launchy::Browser.new.browser.should == v ENV[e] = nil end end it "reports when it cannot find an browser" do old_error = $stderr $stderr = StringIO.new ENV["LAUNCHY_HOST_OS"] = "linux" begin browser = Launchy::Browser.new rescue => e e.message.should =~ /Unable to find browser to launch for os family/m end ENV["LAUNCHY_HOST_OS"] = nil $stderr.string.should =~ /Unable to launch. No Browser application found./m $stderr = old_error end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
launchy-0.3.1 | spec/browser_spec.rb |
launchy-0.3.2 | spec/browser_spec.rb |