-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfile_match_spec.rb
39 lines (34 loc) · 1.11 KB
/
file_match_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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