mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
32 lines
872 B
Crystal
32 lines
872 B
Crystal
require "../../spec_helper"
|
|
|
|
module Ameba
|
|
private def with_rule_collection_presenter(&)
|
|
with_presenter(Presenter::RuleCollectionPresenter) do |presenter, io|
|
|
rules = Config.load.rules
|
|
presenter.run(rules)
|
|
|
|
output = io.to_s
|
|
output = Formatter::Util.deansify(output).to_s
|
|
|
|
yield rules, output, presenter
|
|
end
|
|
end
|
|
|
|
describe Presenter::RuleCollectionPresenter do
|
|
it "outputs rule collection details" do
|
|
with_rule_collection_presenter do |rules, output|
|
|
rules.each do |rule|
|
|
output.should contain rule.name
|
|
output.should contain rule.severity.symbol
|
|
|
|
if description = rule.description
|
|
output.should contain description
|
|
end
|
|
end
|
|
output.should contain "Total rules: #{rules.size}"
|
|
output.should match /\d+ enabled/
|
|
end
|
|
end
|
|
end
|
|
end
|