File tree 2 files changed +23
-1
lines changed
2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,15 @@ module Ameba::Rule::Lint
60
60
subject.catch(s).should_not be_valid
61
61
end
62
62
63
+ it " reports if there is a spec item with `focus: !true`" do
64
+ s = Source .new %(
65
+ it "it", focus: !true do
66
+ end
67
+ ) , path: " source_spec.cr"
68
+
69
+ subject.catch(s).should_not be_valid
70
+ end
71
+
63
72
it " does not report if there is non spec block with :focus" do
64
73
s = Source .new %(
65
74
some_method "foo", focus: true do
@@ -69,6 +78,17 @@ module Ameba::Rule::Lint
69
78
subject.catch(s).should be_valid
70
79
end
71
80
81
+ it " does not report if is a parameterized focused spec item" do
82
+ s = Source .new %(
83
+ def assert_foo(focus = false)
84
+ it "foo", focus: focus do
85
+ end
86
+ end
87
+ ) , path: " source_spec.cr"
88
+
89
+ subject.catch(s).should be_valid
90
+ end
91
+
72
92
it " does not report if there is a tagged item with :focus" do
73
93
s = Source .new %(
74
94
it "foo", tags: "focus" do
Original file line number Diff line number Diff line change @@ -65,7 +65,9 @@ module Ameba::Rule::Lint
65
65
return unless node.block
66
66
67
67
arg = node.named_args.try & .find(& .name.== " focus" )
68
- return unless arg
68
+ return if arg.nil? ||
69
+ arg.value.is_a?(Crystal ::Call ) ||
70
+ arg.value.is_a?(Crystal ::Var )
69
71
70
72
issue_for arg, MSG
71
73
end
You can’t perform that action at this time.
0 commit comments