Sha256: 67513192df7531d734ef960b21d05138956492b6985f16f96f9c9dad3f516686

Contents?: true

Size: 1.11 KB

Versions: 3

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'
require 'bukin'

describe Bukin::FileMatch do
  it 'matches anything passed to it' do
    match = Bukin::FileMatch.any
    match.should =~ 'filename.jar'
    match.should =~ 'another-file-name.jar'
    match.should =~ 'yet_another.zip'
  end

  it 'matches a string' do
    match = Bukin::FileMatch.new('filename.jar')
    match.should =~ 'filename.jar'
    match.should_not =~ 'another-file-name.jar'
    match.should_not =~ 'yet_another.zip'
  end
   
  it 'matches a regex' do
    match = Bukin::FileMatch.new(/^.*\.jar$/)
    match.should =~ 'filename.jar'
    match.should =~ 'another-file-name.jar'
    match.should_not =~ 'yet_another.zip'
  end

  it 'matches an array of matches' do
    match = Bukin::FileMatch.new(['filename.jar', 'another-file-name.jar'])
    match.should =~ 'filename.jar'
    match.should =~ 'another-file-name.jar'
    match.should_not =~ 'yet_another.zip'
  end

  it 'matches none for other types' do
    match = Bukin::FileMatch.new(:filename)
    match.should_not =~ 'filename.jar'
    match.should_not =~ 'another-file-name.jar'
    match.should_not =~ 'yet_another.zip'
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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