File tree Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ def check_previous_nodes(node)
4747 if offending? ( sibling )
4848 msg = format ( MSG , offending : sibling . method_name )
4949 add_offense ( node , message : msg ) do |corrector |
50- autocorrect ( corrector , node )
50+ autocorrect ( corrector , node , sibling )
5151 end
5252 end
5353
@@ -57,21 +57,16 @@ def check_previous_nodes(node)
5757
5858 private
5959
60- def autocorrect ( corrector , node )
61- first_node = find_first_offending_node ( node )
60+ def autocorrect ( corrector , node , sibling )
6261 RuboCop ::RSpec ::Corrector ::MoveNode . new (
6362 node , corrector , processed_source
64- ) . move_before ( first_node )
63+ ) . move_before ( sibling )
6564 end
6665
6766 def offending? ( node )
6867 let? ( node ) || hook? ( node ) || example? ( node )
6968 end
7069
71- def find_first_offending_node ( node )
72- node . parent . children . find { |sibling | offending? ( sibling ) }
73- end
74-
7570 def in_spec_block? ( node )
7671 node . each_ancestor ( :block ) . any? do |ancestor |
7772 example? ( ancestor )
You can’t perform that action at this time.
0 commit comments