rails5-spec-converter 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9221acc93243c2c9f8648ad06d5df50a1efa4233
|
4
|
+
data.tar.gz: a4e9cf2ec31737bd4dff468227b37124aec92fb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a44c9317b009e1588ba7e0b6a66f9dabb1ecd630a9970ba3116436ef6b2e91aa390ac03fb88b0f8eb35be4366f058c9b049dbd8f1ba2c16843b9d4a4bf7fab41
|
7
|
+
data.tar.gz: 4607141c2ec87dc5de0a3e02c2a1017929a7d7ae15340ad9676f3a63133e18f5089e44e8bb03991ed8b434f924fa38171a2bc9959c4cb54302b23f433448d427
|
@@ -28,6 +28,8 @@ module Rails5
|
|
28
28
|
next unless target.nil? && HTTP_VERBS.include?(verb)
|
29
29
|
|
30
30
|
if args[0].hash_type? && args[0].children.length > 0
|
31
|
+
next if looks_like_route_definition?(args[0])
|
32
|
+
|
31
33
|
write_params_hash(source_rewriter, args[0])
|
32
34
|
else
|
33
35
|
wrap_arg(source_rewriter, args[0], 'params')
|
@@ -41,6 +43,21 @@ module Rails5
|
|
41
43
|
|
42
44
|
private
|
43
45
|
|
46
|
+
def looks_like_route_definition?(hash_node)
|
47
|
+
keys = hash_node.children.map { |pair| pair.children[0].children[0] }
|
48
|
+
return true if (keys & [:to, :controller]) == keys
|
49
|
+
|
50
|
+
hash_node.children.each do |pair|
|
51
|
+
key = pair.children[0].children[0]
|
52
|
+
value = pair.children[1].children[0]
|
53
|
+
if key == :to
|
54
|
+
return true if value.match(/^\w+#\w+$/)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
false
|
59
|
+
end
|
60
|
+
|
44
61
|
def write_params_hash(source_rewriter, hash_node)
|
45
62
|
pairs_that_belong_in_params = []
|
46
63
|
pairs_that_belong_outside_params = []
|