Sha256: a7c9d368b6ccffd2d3fc65d3fcb199dc7a37383dc422efd9d424bef51e6bf24c

Contents?: true

Size: 979 Bytes

Versions: 3

Compression:

Stored size: 979 Bytes

Contents

require 'spec_helper'
require 'bukin'
require 'bukin/installer'

describe Bukin::Installer do
  describe :get_match do
    before :all do
      @installer = Bukin::Installer.new(nil)
    end

    it 'directly returns a regex' do
      @installer.get_match(/something/).should == /something/
    end

    it 'wraps a string with start and end anchors' do
      @installer.get_match('something').should == /^something$/
    end

    it 'matches anything for :all' do
      @installer.get_match(:all).should == //
    end

    it 'matches .jar files by default' do
      @installer.get_match(nil).should == /\.jar$/
    end

    it 'errors when given anything else' do
      expect do
        @installer.get_match({})
      end.to raise_error(Bukin::InstallError)

      expect do
        @installer.get_match([])
      end.to raise_error(Bukin::InstallError)

      expect do
        @installer.get_match(Object.new)
      end.to raise_error(Bukin::InstallError)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bukin-0.9.0 spec/installer_spec.rb
bukin-0.8.0 spec/installer_spec.rb
bukin-0.7.0 spec/installer_spec.rb