Skip to content

Commit 10874c0

Browse files
committed
rewrite factory_bot/use_string_as_class_name
1 parent b520acd commit 10874c0

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/factory_bot/use_string_as_class_name.rb

+2-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@
2626
EOS
2727

2828
within_files Synvert::RAILS_FACTORY_FILES do
29-
find_node '.block[caller=.send[message=factory][arguments.size=2]] caller.arguments
30-
.hash:has(.pair[key=class][value=.const])' do
31-
replace 'class_value', with: wrap_with_quotes(node.class_source)
29+
find_node '.block[caller=.send[message=factory][arguments.size=2][arguments.-1=.hash[class_value=.const]]]' do
30+
replace 'caller.arguments.-1.class_value', with: wrap_with_quotes(node.caller.arguments.last.class_source)
3231
end
3332
end
3433
end

0 commit comments

Comments
 (0)