mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Merge pull request #420 from crystal-ameba/add-spec-filename-rule
Add `Lint/SpecFilename` rule
This commit is contained in:
commit
a40f02f77f
2 changed files with 86 additions and 0 deletions
36
spec/ameba/rule/lint/spec_filename_spec.cr
Normal file
36
spec/ameba/rule/lint/spec_filename_spec.cr
Normal file
|
@ -0,0 +1,36 @@
|
|||
require "../../../spec_helper"
|
||||
|
||||
module Ameba::Rule::Lint
|
||||
subject = SpecFilename.new
|
||||
|
||||
describe SpecFilename do
|
||||
it "passes if filename is correct" do
|
||||
expect_no_issues subject, code: "", path: "spec/foo_spec.cr"
|
||||
expect_no_issues subject, code: "", path: "spec/foo/bar_spec.cr"
|
||||
end
|
||||
|
||||
it "fails if filename is wrong" do
|
||||
expect_issue subject, <<-CRYSTAL, path: "spec/foo.cr"
|
||||
|
||||
# ^{} error: Spec filename should have `_spec` suffix: foo_spec.cr, not foo.cr
|
||||
CRYSTAL
|
||||
end
|
||||
|
||||
context "properties" do
|
||||
context "#ignored_dirs" do
|
||||
it "provide sane defaults" do
|
||||
expect_no_issues subject, code: "", path: "spec/support/foo.cr"
|
||||
expect_no_issues subject, code: "", path: "spec/fixtures/foo.cr"
|
||||
expect_no_issues subject, code: "", path: "spec/data/foo.cr"
|
||||
end
|
||||
end
|
||||
|
||||
context "#ignored_filenames" do
|
||||
it "ignores spec_helper by default" do
|
||||
expect_no_issues subject, code: "", path: "spec/spec_helper.cr"
|
||||
expect_no_issues subject, code: "", path: "spec/foo/spec_helper.cr"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue