rails5-spec-converter 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e051f5090f09b08d27863b080ad002abc60a43a4
4
- data.tar.gz: 6662badfc382d19cb8108ae8cf931f83afde9a4c
3
+ metadata.gz: 9221acc93243c2c9f8648ad06d5df50a1efa4233
4
+ data.tar.gz: a4e9cf2ec31737bd4dff468227b37124aec92fb3
5
5
  SHA512:
6
- metadata.gz: bed2ebb16380b55efc0fb5de791df001a061867d8157add9928c667be0752995860dd7ac004abe1f28f46c47f874612087103763ab60f52b2d6f2b9d4ee7c41c
7
- data.tar.gz: f39109b7226c6f260d33441716d6ebaa34bbe51e59df80e04b6bba5dd275a66dbb3fb832b90ab6b065c586a7328d944df17c2b725532f711862aab99b717fb5d
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 = []
@@ -1,5 +1,5 @@
1
1
  module Rails5
2
2
  module SpecConverter
3
- VERSION = "1.0.2"
3
+ VERSION = "1.0.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails5-spec-converter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Travis Grathwell