rails5-spec-converter 1.0.19 → 1.0.20

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: b8ed726d17eeded2ad212304686feb640a5a87e0
4
- data.tar.gz: 5c3b38ee09a37981a347ff0e88fa432edf4f60f2
3
+ metadata.gz: c39727a6db3accd9728ab2c8bfa6d815f643a4a8
4
+ data.tar.gz: 9e5417f24316cc7e52e641a9326300a53076b860
5
5
  SHA512:
6
- metadata.gz: 3526ec24e89a2ede5ba18da2cf814a23578f062f1206de35befae62fd49a35f2ce0a8d2b2a87f5ff1856cab5c3598e21c3dac1869f2586de9347c98622c0457d
7
- data.tar.gz: 990cf71407cdf8017c3299b9639176cdd54056cc47e981cbcac027c3e7bf3482b7c2fca8bc5873c0a72c44b3a6a89abdd91a41564c3868896c8a2634d18acccb
6
+ metadata.gz: 567c6d0ce3b8cb2ba351c66016cfca5b48237bb1a1320b75db87d422b8b666cf8bc0eeb20f16afa850a95da025b94445b58b366b9295e2c45f373dcb8baa294f
7
+ data.tar.gz: 1d24dea46469e77d819a67351601b004ac25ed9b4ef5fe53cefa241e2a5e27cdbcdffdd73c471746490a4a1148215a9b81fbc75d651787bf4200bde3546fee4c
@@ -58,6 +58,13 @@ module Rails5
58
58
  hash_rewriter.rewritten_params_hash
59
59
  ) if hash_rewriter.should_rewrite_hash?
60
60
  end
61
+ elsif args[0].nil_type? && args.length > 1
62
+ nil_arg_range = Parser::Source::Range.new(
63
+ @source_buffer,
64
+ args[0].loc.expression.begin_pos,
65
+ args[1].loc.expression.begin_pos
66
+ )
67
+ @source_rewriter.remove(nil_arg_range)
61
68
  else
62
69
  warn_about_ambiguous_params(node) if @options.warn_about_ambiguous_params?
63
70
  handle_ambiguous_method_call!(node)
@@ -87,10 +94,20 @@ module Rails5
87
94
  ].join('.')
88
95
 
89
96
  text_before_node = node.loc.expression.source_line[0...node.loc.expression.column]
90
- first_line_content = "_inner, _outer = #{partition_clause}"
97
+ first_line_content = "_outer, _inner = #{partition_clause}"
91
98
  if text_before_node =~ /^\s+$/
92
99
  @source_rewriter.insert_before(node.loc.expression, "#{first_line_content}\n#{line_indent(node)}")
93
- @source_rewriter.replace(args[0].loc.expression, '_outer.merge(params: _inner)')
100
+ if args.length == 1
101
+ @source_rewriter.replace(args[0].loc.expression, '_outer.merge(params: _inner)')
102
+ else
103
+ replacement_range = Parser::Source::Range.new(
104
+ @source_buffer,
105
+ args[0].loc.expression.begin_pos,
106
+ args[1].loc.expression.begin_pos
107
+ )
108
+ @source_rewriter.replace(replacement_range, '_outer.merge(params: _inner).merge(')
109
+ @source_rewriter.insert_after(args.last.loc.expression, ')')
110
+ end
94
111
  else
95
112
  return unless in_a_block_with_only_whitespace?(node)
96
113
 
@@ -1,5 +1,5 @@
1
1
  module Rails5
2
2
  module SpecConverter
3
- VERSION = "1.0.19"
3
+ VERSION = "1.0.20"
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.19
4
+ version: 1.0.20
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-10-11 00:00:00.000000000 Z
11
+ date: 2016-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser