Skip to content

Commit 3c5be50

Browse files
author
Awesome Code
committed
Auto corrected by following Format Ruby Code
1 parent 15b76a9 commit 3c5be50

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

lib/rails/convert_rails_test_request_methods_4_2_to_5_0.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
next if argument_node.to_source == 'nil'
3636

3737
if argument_node.type == :hash
38-
new_value = argument_node.children.reject { |pair_node| pair_node.key.to_value == :format }
39-
.map(&:to_source).join(', ')
38+
new_value =
39+
argument_node.children.reject { |pair_node| pair_node.key.to_value == :format }.map(&:to_source).join(', ')
4040
"#{key}: #{add_curly_brackets_if_necessary(new_value)}"
4141
else
4242
"#{key}: #{argument_node.to_source}"
@@ -89,8 +89,7 @@
8989
%w[get post put patch delete].each do |message|
9090
with_node type: 'send', message: message do
9191
next unless node.arguments.size > 1
92-
if node.arguments[1].type == :hash &&
93-
(node.arguments[1].key?(:params) || node.arguments[1].key?(:headers))
92+
if node.arguments[1].type == :hash && (node.arguments[1].key?(:params) || node.arguments[1].key?(:headers))
9493
next
9594
end
9695

lib/rails/convert_routes_2_3_to_3_0.rb

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -327,26 +327,26 @@
327327
url = node.arguments.first.to_value
328328
hash_node = node.arguments.last
329329
if hash_node.type == :hash && hash_node.key?(:controller)
330-
if hash_node.key?(:action) || url !~ /:action/
331-
controller_action_name =
332-
if hash_node.key?(:action)
333-
extract_controller_action_name(hash_node)
334-
else
335-
"#{hash_node.hash_value(:controller).to_value}#index"
336-
end
337-
method = extract_method(hash_node)
338-
subdomain_node = extract_subdomain_node(hash_node)
339-
other_options_code = reject_keys_from_hash(hash_node, :controller, :action, :method, :conditions)
340-
other_options_code += ":constraints => {:subdomain => #{subdomain_node.to_source}}" if subdomain_node
341-
if other_options_code.length > 0
342-
replace_with "#{method} {{arguments.first}}, :to => \"#{controller_action_name}\", #{other_options_code}, :as => \"#{message}\""
330+
if hash_node.key?(:action) || url !~ /:action/
331+
controller_action_name =
332+
if hash_node.key?(:action)
333+
extract_controller_action_name(hash_node)
343334
else
344-
replace_with "#{method} {{arguments.first}}, :to => \"#{controller_action_name}\", :as => \"#{message}\""
335+
"#{hash_node.hash_value(:controller).to_value}#index"
345336
end
337+
method = extract_method(hash_node)
338+
subdomain_node = extract_subdomain_node(hash_node)
339+
other_options_code = reject_keys_from_hash(hash_node, :controller, :action, :method, :conditions)
340+
other_options_code += ":constraints => {:subdomain => #{subdomain_node.to_source}}" if subdomain_node
341+
if other_options_code.length > 0
342+
replace_with "#{method} {{arguments.first}}, :to => \"#{controller_action_name}\", #{other_options_code}, :as => \"#{message}\""
346343
else
347-
replace_with 'match {{arguments}}'
344+
replace_with "#{method} {{arguments.first}}, :to => \"#{controller_action_name}\", :as => \"#{message}\""
348345
end
346+
else
347+
replace_with 'match {{arguments}}'
349348
end
349+
end
350350
end
351351
end
352352
end

spec/rails/convert_rails_test_request_methods_4_2_to_5_0_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def test_xhr
3131
end
3232
end
3333
EOS
34+
3435
let(:test_rewritten_content) { <<~EOS }
3536
class PostsControllerTest < ActionController::TestCase
3637
def test_show

0 commit comments

Comments
 (0)