mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Refactor formatters
This commit is contained in:
parent
1a3bb3629e
commit
f878ac430f
6 changed files with 149 additions and 68 deletions
41
spec/ameba/formatter/dot_formatter_spec.cr
Normal file
41
spec/ameba/formatter/dot_formatter_spec.cr
Normal file
|
@ -0,0 +1,41 @@
|
|||
require "../../spec_helper"
|
||||
|
||||
module Ameba::Formatter
|
||||
describe DotFormatter do
|
||||
output = IO::Memory.new
|
||||
subject = DotFormatter.new output
|
||||
|
||||
describe "#started" do
|
||||
it "writes started message" do
|
||||
subject.started [Source.new ""]
|
||||
output.to_s.should eq "Inspecting 1 file.\n\n"
|
||||
end
|
||||
end
|
||||
|
||||
describe "#source_finished" do
|
||||
it "writes valid source" do
|
||||
subject.source_finished Source.new ""
|
||||
output.to_s.should contain "."
|
||||
end
|
||||
|
||||
it "writes invalid source" do
|
||||
s = Source.new ""
|
||||
s.error DummyRule.new, 3, "message"
|
||||
subject.source_finished s
|
||||
output.to_s.should contain "F"
|
||||
end
|
||||
end
|
||||
|
||||
describe "#finished" do
|
||||
it "writes a final message" do
|
||||
subject.finished [Source.new ""]
|
||||
output.to_s.should contain "1 inspected, 0 failures."
|
||||
end
|
||||
|
||||
it "writes the elapsed time" do
|
||||
subject.finished [Source.new ""]
|
||||
output.to_s.should contain "Finished in"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue