rails5-spec-converter 1.0.6 → 1.0.8

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: 75759003b02014251aae8a73ba90520b0e449412
4
- data.tar.gz: 90d16a171d1f9b20561f213611f34f0e6c7720dc
3
+ metadata.gz: 09acdaf5aac98f957adf479e15e41fdcb50c15b8
4
+ data.tar.gz: 944323eb7a81f0968b71add26521ef9c05a056c7
5
5
  SHA512:
6
- metadata.gz: 81753ebe7dd82067d0972ed3457f152f4461df3fc934573a3befbbb5dfe81d8481142f2f6ca21cf7900ce6101f39e870843e64e282ff46a59c8859b3e6557d64
7
- data.tar.gz: 3a5e61d1fa027f4cba47220ba0b54222c0df770e655f586eaa89a59d88c864ecb3ac7ad7b5163e34c472588662ceb1031c553f4650963d0636997d93feb41893
6
+ metadata.gz: 0cdfe7db58fdef963722fabe00c9cf97ba976ad4ec9f5b6501f6c469fdcab2832aaf6a50d68f2dfdafc328923eb538712ba1316c002ced809ae50eea3a0b7504
7
+ data.tar.gz: 0f717273ca4a3c6767852cf248ceb9a137325f093de2ce1fee6475207dc24b3b1cf9abd1c90a127e7d4373662b14b085eff5d6a5a4106d3e613b05cfe534ce46
@@ -31,6 +31,7 @@ module Rails5
31
31
 
32
32
  if args[0].hash_type? && args[0].children.length > 0
33
33
  next if looks_like_route_definition?(args[0])
34
+ next if has_key?(args[0], :params)
34
35
 
35
36
  write_params_hash(source_rewriter, args[0])
36
37
  else
@@ -63,6 +64,10 @@ module Rails5
63
64
  false
64
65
  end
65
66
 
67
+ def has_key?(hash_node, key)
68
+ hash_node.children.any? { |pair| pair.children[0].children[0] == key }
69
+ end
70
+
66
71
  def write_params_hash(source_rewriter, hash_node)
67
72
  pairs_that_belong_in_params = []
68
73
  pairs_that_belong_outside_params = []
@@ -105,7 +110,7 @@ module Rails5
105
110
  def indent_after_last_pair(hash_node)
106
111
  return nil unless hash_node.children.length > 0
107
112
 
108
- text_after_last_pair = @content[hash_node.children.last.loc.expression.begin_pos...hash_node.loc.expression.end_pos]
113
+ text_after_last_pair = @content[hash_node.children.last.loc.expression.end_pos...hash_node.loc.expression.end_pos]
109
114
  extract_indent(text_after_last_pair)
110
115
  end
111
116
 
@@ -1,5 +1,5 @@
1
1
  module Rails5
2
2
  module SpecConverter
3
- VERSION = "1.0.6"
3
+ VERSION = "1.0.8"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails5-spec-converter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Travis Grathwell
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-22 00:00:00.000000000 Z
11
+ date: 2016-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser