Prevent disabling of UnneededDisableDirective rule

This commit is contained in:
Vitalii Elenhaupt 2018-02-02 10:52:21 +02:00 committed by V. Elenhaupt
parent 8075c39aa9
commit 6fb483a2dd
4 changed files with 18 additions and 3 deletions

View file

@ -65,6 +65,15 @@ module Ameba::Rule
s.errors.last.message.should contain "Rule3"
end
it "fails if there is disabled UnneededDisableDirective" do
s = Source.new %Q(
# ameba:disable #{UnneededDisableDirective.class_name}
a = 1
), "source.cr"
s.error UnneededDisableDirective.new, 3, 1, "Alarm!", :disabled
subject.catch(s).should_not be_valid
end
it "reports error, location and message" do
s = Source.new %Q(
# ameba:disable Rule1, Rule2