Sha256: 0d8e58d27425864394de0d992c1c92678873a847456b49dcda74529be0335505

Contents?: true

Size: 1.07 KB

Versions: 8

Compression:

Stored size: 1.07 KB

Contents

require 'spec_helper'
require 'mock_scheme'

class JunkApp < Launchy::Application
  def self.schemes
    %w[ junk ]
  end
end

describe Launchy::Application do
  it 'registers inherited classes' do
    class Junk2App < Launchy::Application
      def self.schemes
        %w[ junk2 ]
      end
    end
    Launchy::Application.children.must_include( Junk2App )
    Launchy::Application.children.delete( Junk2App )
  end

  it "can find an app" do
    Launchy::Application.children.must_include( JunkApp )
    Launchy::Application.scheme_list.size.must_equal 7
    Launchy::Application.for_scheme( "junk" ).must_equal( JunkApp  )
  end

  it "raises an error if an application cannot be found for the given scheme" do
    lambda { Launchy::Application.for_scheme( "foo" ) }.must_raise( Launchy::SchemeNotFoundError )
  end

  it "can find open or curl" do
    found = %w[ open curl ].any? do |app|
      Launchy::Application.find_executable( app )
    end
    found.must_equal true
  end

  it "does not find xyzzy" do
    Launchy::Application.find_executable( "xyzzy" ).must_equal  nil
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
launchy-2.0.3-java spec/application_spec.rb
launchy-2.0.3 spec/application_spec.rb
launchy-2.0.2-java spec/application_spec.rb
launchy-2.0.2 spec/application_spec.rb
launchy-2.0.1 spec/application_spec.rb
launchy-2.0.1-java spec/application_spec.rb
launchy-2.0.0-java spec/application_spec.rb
launchy-2.0.0 spec/application_spec.rb