mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Add specs for COMMENT_DIRECTIVE_REGEX
This commit is contained in:
parent
4a8320d1e0
commit
1d827b4969
1 changed files with 18 additions and 0 deletions
|
@ -2,6 +2,24 @@ require "../spec_helper"
|
|||
|
||||
module Ameba
|
||||
describe InlineComments do
|
||||
describe InlineComments::COMMENT_DIRECTIVE_REGEX do
|
||||
subject = InlineComments::COMMENT_DIRECTIVE_REGEX
|
||||
|
||||
it "allows to parse action and rule name" do
|
||||
result = subject.match("#ameba:enable Group/RuleName")
|
||||
result.should_not be_nil
|
||||
result.not_nil![1].should eq "enable"
|
||||
result.not_nil![2].should eq "Group/RuleName"
|
||||
end
|
||||
|
||||
it "ignores the repeatable spaces" do
|
||||
result = subject.match("# ameba : enable Group/RuleName")
|
||||
result.should_not be_nil
|
||||
result.not_nil![1].should eq "enable"
|
||||
result.not_nil![2].should eq "Group/RuleName"
|
||||
end
|
||||
end
|
||||
|
||||
it "disables a rule with a comment directive" do
|
||||
s = Source.new %Q(
|
||||
# ameba:disable #{NamedRule.name}
|
||||
|
|
Loading…
Reference in a new issue