Exclude file pattern match

closes #61
This commit is contained in:
Vitalii Elenhaupt 2018-05-29 13:19:00 +03:00
parent c12b4f1aa5
commit e1b51f62a5
No known key found for this signature in database
GPG key ID: 7558EF3A4056C706
4 changed files with 21 additions and 4 deletions

View file

@ -55,10 +55,10 @@ module Ameba::Rule
rule.excluded?(Source.new "", "source.cr").should be_true
end
pending "returns true if source matches the wildcard" do
it "returns true if source matches the wildcard" do
rule = DummyRule.new
rule.excluded = %w(**/*.cr)
rule.excluded?(Source.new "", "source.cr").should be_true
rule.excluded?(Source.new "", __FILE__).should be_true
end
it "returns false if source does not match the wildcard" do

View file

@ -35,5 +35,17 @@ module Ameba
s.fullpath.should_not be_nil
end
end
describe "#matches_path?" do
it "returns true if source's path is matched" do
s = Source.new "", "source.cr"
s.matches_path?("source.cr").should be_true
end
it "returns false if source's path is not matched" do
s = Source.new "", "source.cr"
s.matches_path?("new_source.cr").should be_false
end
end
end
end