File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
lib/rubocop/cop/rspec/factory_bot Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -31,12 +31,15 @@ class AttributeDefinedStatically < Cop
3131 (send _ !#reserved_method? $...)
3232 PATTERN
3333
34- def_node_search :factory_attributes , <<-PATTERN
34+ def_node_matcher :factory_attributes , <<-PATTERN
3535 (block (send _ #attribute_defining_method? ...) _ { (begin $...) $(send ...) } )
3636 PATTERN
3737
3838 def on_block ( node )
39- factory_attributes ( node ) . to_a . flatten . each do |attribute |
39+ attributes = factory_attributes ( node ) || [ ]
40+ attributes = [ attributes ] unless attributes . is_a? ( Array )
41+
42+ attributes . each do |attribute |
4043 next unless offensive_receiver? ( attribute . receiver , node )
4144 next if proc? ( attribute ) || association? ( attribute . first_argument )
4245
You can’t perform that action at this time.
0 commit comments