mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
ea98554191
* Add support for showing end location marker * Cleanup Reportable method definitions There’s no need for double splats, since they mess up method resolution, and obscure the actual - single (!) - argument - `status`, so… be gone Also, all of the helpers return the constructed `Issue` like a behaving good methods. * Refactor Util#affected_code * Increase max length of trimmed lines to 120 characters * Refactor Issue to use enum instead of a symbol for #status * Optimize Reportable#valid? * Add spec coverage for newly added Util methods * Refactor DotFormatter a bit Make text format moar in line with Crystal spec runner. * Update README.md
63 lines
1.5 KiB
Crystal
63 lines
1.5 KiB
Crystal
require "../spec_helper"
|
|
|
|
module Ameba
|
|
describe Issue do
|
|
it "accepts rule and message" do
|
|
issue = Issue.new rule: DummyRule.new,
|
|
location: nil,
|
|
end_location: nil,
|
|
message: "Blah",
|
|
status: nil
|
|
|
|
issue.rule.should_not be_nil
|
|
issue.message.should eq "Blah"
|
|
end
|
|
|
|
it "accepts location" do
|
|
location = Crystal::Location.new("path", 3, 2)
|
|
issue = Issue.new rule: DummyRule.new,
|
|
location: location,
|
|
end_location: nil,
|
|
message: "Blah",
|
|
status: nil
|
|
|
|
issue.location.to_s.should eq location.to_s
|
|
issue.end_location.should eq nil
|
|
end
|
|
|
|
it "accepts end_location" do
|
|
location = Crystal::Location.new("path", 3, 2)
|
|
issue = Issue.new rule: DummyRule.new,
|
|
location: nil,
|
|
end_location: location,
|
|
message: "Blah",
|
|
status: nil
|
|
|
|
issue.location.should eq nil
|
|
issue.end_location.to_s.should eq location.to_s
|
|
end
|
|
|
|
it "accepts status" do
|
|
issue = Issue.new rule: DummyRule.new,
|
|
location: nil,
|
|
end_location: nil,
|
|
message: "",
|
|
status: :disabled
|
|
|
|
issue.status.should eq Issue::Status::Disabled
|
|
issue.disabled?.should be_true
|
|
issue.enabled?.should be_false
|
|
end
|
|
|
|
it "sets status to :enabled by default" do
|
|
issue = Issue.new rule: DummyRule.new,
|
|
location: nil,
|
|
end_location: nil,
|
|
message: ""
|
|
|
|
issue.status.should eq Issue::Status::Enabled
|
|
issue.enabled?.should be_true
|
|
issue.disabled?.should be_false
|
|
end
|
|
end
|
|
end
|