mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Allow filtering by group name (#65)
This commit is contained in:
parent
4cb5328513
commit
fafc5f4bdc
6 changed files with 102 additions and 11 deletions
|
@ -80,5 +80,39 @@ module Ameba
|
|||
rule.excluded.should eq excluded
|
||||
end
|
||||
end
|
||||
|
||||
describe "#update_rules" do
|
||||
config = Config.load config_sample
|
||||
|
||||
it "updates multiple rules by enabled property" do
|
||||
name = DummyRule.rule_name
|
||||
config.update_rules [name], enabled: false
|
||||
rule = config.rules.find(&.name.== name).not_nil!
|
||||
rule.enabled.should be_false
|
||||
end
|
||||
|
||||
it "updates multiple rules by excluded property" do
|
||||
name = DummyRule.rule_name
|
||||
excluded = %w(spec/source.cr)
|
||||
config.update_rules [name], excluded: excluded
|
||||
rule = config.rules.find(&.name.== name).not_nil!
|
||||
rule.excluded.should eq excluded
|
||||
end
|
||||
|
||||
it "updates a group of rules by enabled property" do
|
||||
group = DummyRule.group_name
|
||||
config.update_rules [group], enabled: false
|
||||
rule = config.rules.find(&.name.== DummyRule.rule_name).not_nil!
|
||||
rule.enabled.should be_false
|
||||
end
|
||||
|
||||
it "updates a group by excluded property" do
|
||||
name = DummyRule.group_name
|
||||
excluded = %w(spec/source.cr)
|
||||
config.update_rules [name], excluded: excluded
|
||||
rule = config.rules.find(&.name.== DummyRule.rule_name).not_nil!
|
||||
rule.excluded.should eq excluded
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,6 +14,12 @@ module Ameba
|
|||
DummyRule.new.name.should eq "Ameba/DummyRule"
|
||||
end
|
||||
end
|
||||
|
||||
describe "#group" do
|
||||
it "returns a group rule belongs to" do
|
||||
DummyRule.new.group.should eq "Ameba"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe Rule do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue