Skip to content

Commit

Permalink
Add spec for RuleVersionsPresenter
Browse files Browse the repository at this point in the history
  • Loading branch information
Sija committed Oct 14, 2024
1 parent eeeb8cc commit 1c6572e
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions spec/ameba/presenter/rule_versions_presenter_spec.cr
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
require "../../spec_helper"

module Ameba
private def with_rule_versions_presenter(&)
with_presenter(Presenter::RuleVersionsPresenter) 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::RuleVersionsPresenter do
it "outputs rule versions" do
with_rule_versions_presenter do |_rules, output|
output.should contain <<-TEXT
- 0.1.0
- Layout/LineLength
- Layout/TrailingBlankLines
- Layout/TrailingWhitespace
- Lint/ComparisonToBoolean
- Lint/DebuggerStatement
- Lint/LiteralInCondition
- Lint/LiteralInInterpolation
- Style/UnlessElse
TEXT
end
end
end
end

0 comments on commit 1c6572e

Please sign in to comment.