minitest_to_rspec 0.9.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/.rubocop_todo.yml +3 -3
- data/.travis.yml +0 -1
- data/CHANGELOG.md +35 -30
- data/Gemfile +2 -0
- data/Rakefile +2 -0
- data/bin/console +1 -0
- data/bin/mt2rspec +2 -0
- data/lib/minitest_to_rspec/cli.rb +2 -0
- data/lib/minitest_to_rspec/converter.rb +2 -0
- data/lib/minitest_to_rspec/errors.rb +2 -0
- data/lib/minitest_to_rspec/model/base.rb +2 -0
- data/lib/minitest_to_rspec/model/call.rb +2 -0
- data/lib/minitest_to_rspec/model/calls/once.rb +2 -0
- data/lib/minitest_to_rspec/model/calls/returns.rb +2 -0
- data/lib/minitest_to_rspec/model/calls/twice.rb +2 -0
- data/lib/minitest_to_rspec/model/defn.rb +23 -0
- data/lib/minitest_to_rspec/model/hash_exp.rb +2 -0
- data/lib/minitest_to_rspec/model/iter.rb +2 -0
- data/lib/minitest_to_rspec/model/klass.rb +2 -0
- data/lib/minitest_to_rspec/processor.rb +7 -0
- data/lib/minitest_to_rspec/sexp_assertions.rb +2 -0
- data/lib/minitest_to_rspec/subprocessors/base.rb +2 -0
- data/lib/minitest_to_rspec/subprocessors/call.rb +2 -0
- data/lib/minitest_to_rspec/subprocessors/defn.rb +44 -0
- data/lib/minitest_to_rspec/subprocessors/iter.rb +2 -0
- data/lib/minitest_to_rspec/subprocessors/klass.rb +2 -0
- data/lib/minitest_to_rspec/version.rb +8 -1
- data/lib/minitest_to_rspec.rb +2 -0
- data/minitest_to_rspec.gemspec +2 -1
- metadata +8 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '079eae592894615cc1b10834116d5b0e02db3a04'
|
4
|
+
data.tar.gz: b50df3b0e24960b4877518c354cbee368c91528d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a637880b785137bc6c49bcc4b87f87f0f9ae3fbf91897627e4b3e8cd1b399e1e65d1d999114e697fd96b7350b1a2dd9917c6f9225b943db5ff32fb436b401bb
|
7
|
+
data.tar.gz: c31792040f37beac13d3e19cfeb3c1095577f790fdaceda9e8b34d612e048fc8f7353005af83e86514e7d5b23f960da158a1c7172a94c64ebddb28d04b12c932
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2017-
|
3
|
+
# on 2017-11-01 23:47:55 -0400 using RuboCop version 0.51.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
@@ -139,7 +139,7 @@ Metrics/BlockLength:
|
|
139
139
|
Metrics/ClassLength:
|
140
140
|
Max: 241
|
141
141
|
|
142
|
-
# Offense count:
|
142
|
+
# Offense count: 7
|
143
143
|
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
144
144
|
# URISchemes: http, https
|
145
145
|
Metrics/LineLength:
|
@@ -261,7 +261,7 @@ Style/StderrPuts:
|
|
261
261
|
Exclude:
|
262
262
|
- 'lib/minitest_to_rspec/cli.rb'
|
263
263
|
|
264
|
-
# Offense count:
|
264
|
+
# Offense count: 340
|
265
265
|
# Cop supports --auto-correct.
|
266
266
|
# Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline.
|
267
267
|
# SupportedStyles: single_quotes, double_quotes
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,9 @@
|
|
1
|
-
Change Log
|
2
|
-
==========
|
1
|
+
# Change Log
|
3
2
|
|
4
3
|
This project follows [semver 2.0.0][1] and the recommendations
|
5
4
|
of [keepachangelog.com][2].
|
6
5
|
|
7
|
-
Unreleased
|
8
|
-
-----
|
6
|
+
## Unreleased
|
9
7
|
|
10
8
|
### Breaking Changes
|
11
9
|
|
@@ -19,8 +17,27 @@ Unreleased
|
|
19
17
|
|
20
18
|
- None
|
21
19
|
|
22
|
-
0.
|
23
|
-
|
20
|
+
## 0.10.0 (2017-11-01)
|
21
|
+
|
22
|
+
### Breaking Changes
|
23
|
+
|
24
|
+
- Drop support for ruby < 2.3 so we can use frozen_string_literal
|
25
|
+
- We may now return frozen strings, now that we are using frozen_string_literal.
|
26
|
+
This could affect methods like `Converter#convert`. Even if some method seems
|
27
|
+
to return a thawed string in some situations, users should simiply assume all
|
28
|
+
strings are frozen.
|
29
|
+
|
30
|
+
### Added
|
31
|
+
|
32
|
+
- MinitestToRspec.gem_version
|
33
|
+
- [#7](https://github.com/jaredbeck/minitest_to_rspec/pull/7) - Support for
|
34
|
+
converting methods named test_*
|
35
|
+
|
36
|
+
### Fixed
|
37
|
+
|
38
|
+
- None
|
39
|
+
|
40
|
+
## 0.9.0 (2017-10-24)
|
24
41
|
|
25
42
|
### Breaking Changes
|
26
43
|
|
@@ -35,8 +52,7 @@ None
|
|
35
52
|
- [#4](https://github.com/jaredbeck/minitest_to_rspec/issues/4) - Constrain
|
36
53
|
dependency: sexp_processor < 4.8
|
37
54
|
|
38
|
-
0.8.0
|
39
|
-
-----
|
55
|
+
## 0.8.0
|
40
56
|
|
41
57
|
### Changed
|
42
58
|
|
@@ -52,8 +68,7 @@ None
|
|
52
68
|
|
53
69
|
None
|
54
70
|
|
55
|
-
0.7.1
|
56
|
-
-----
|
71
|
+
## 0.7.1
|
57
72
|
|
58
73
|
### Changed
|
59
74
|
|
@@ -67,8 +82,7 @@ None
|
|
67
82
|
|
68
83
|
- Update sexp2ruby to 0.0.4 (was 0.0.3)
|
69
84
|
|
70
|
-
0.7.0
|
71
|
-
-----
|
85
|
+
## 0.7.0
|
72
86
|
|
73
87
|
### Changed
|
74
88
|
- `assert` on a question-mark method converts to `eq(true)` instead
|
@@ -88,21 +102,18 @@ None
|
|
88
102
|
### Fixed
|
89
103
|
- `__FILE__` keyword in input
|
90
104
|
|
91
|
-
0.6.2
|
92
|
-
-----
|
105
|
+
## 0.6.2
|
93
106
|
|
94
107
|
### Fixed
|
95
108
|
- Make runtime dependency on trollop explicit: declare in gemspec
|
96
109
|
- Improve output: Fewer unnecessary parentheses: to, to_not
|
97
110
|
|
98
|
-
0.6.1
|
99
|
-
-----
|
111
|
+
## 0.6.1
|
100
112
|
|
101
113
|
### Fixed
|
102
114
|
- Improve output: Fewer unnecessary parentheses
|
103
115
|
|
104
|
-
0.6.0
|
105
|
-
-----
|
116
|
+
## 0.6.0
|
106
117
|
|
107
118
|
### Added
|
108
119
|
- Converts
|
@@ -114,16 +125,14 @@ None
|
|
114
125
|
- Will have better output, e.g. ruby 1.9.3 hash syntax
|
115
126
|
- Upgrade to ruby_parser 3.7
|
116
127
|
|
117
|
-
0.5.0
|
118
|
-
-----
|
128
|
+
## 0.5.0
|
119
129
|
|
120
130
|
### Changed
|
121
131
|
- Executable
|
122
132
|
- Renamed from `minitest_to_rspec` to `mt2rspec`
|
123
133
|
- The `target_file` argument is now optional
|
124
134
|
|
125
|
-
0.4.0
|
126
|
-
-----
|
135
|
+
## 0.4.0
|
127
136
|
|
128
137
|
### Added
|
129
138
|
- Experimental
|
@@ -134,8 +143,7 @@ None
|
|
134
143
|
### Fixed
|
135
144
|
- NoMethodError when input contains stabby lambda
|
136
145
|
|
137
|
-
0.3.0
|
138
|
-
-----
|
146
|
+
## 0.3.0
|
139
147
|
|
140
148
|
### Added
|
141
149
|
- Converts
|
@@ -156,20 +164,17 @@ None
|
|
156
164
|
### Fixed
|
157
165
|
- Improved error message for class definition using module shorthand
|
158
166
|
|
159
|
-
0.2.1
|
160
|
-
-----
|
167
|
+
## 0.2.1
|
161
168
|
|
162
169
|
### Fixed
|
163
170
|
- Declare ruby2ruby as a runtime dependency
|
164
171
|
|
165
|
-
0.2.0
|
166
|
-
-----
|
172
|
+
## 0.2.0
|
167
173
|
|
168
174
|
### Added
|
169
175
|
- CLI. Usage: `minitest_to_rspec source_file target_file`
|
170
176
|
|
171
|
-
0.1.0
|
172
|
-
-----
|
177
|
+
## 0.1.0
|
173
178
|
|
174
179
|
Initial release. 11 assertions are supported.
|
175
180
|
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/bin/console
CHANGED
data/bin/mt2rspec
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "base"
|
4
|
+
|
5
|
+
module MinitestToRspec
|
6
|
+
module Model
|
7
|
+
# Data object. Represents a `:defn` s-expression.
|
8
|
+
class Defn < Base
|
9
|
+
def initialize(exp)
|
10
|
+
assert_sexp_type(:defn, exp)
|
11
|
+
@exp = exp.dup
|
12
|
+
end
|
13
|
+
|
14
|
+
def body
|
15
|
+
@exp[3..-1]
|
16
|
+
end
|
17
|
+
|
18
|
+
def method_name
|
19
|
+
@exp[1].to_s
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -1,6 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "ruby_parser"
|
2
4
|
require "sexp_processor"
|
3
5
|
require_relative "subprocessors/call"
|
6
|
+
require_relative "subprocessors/defn"
|
4
7
|
require_relative "subprocessors/klass"
|
5
8
|
require_relative "subprocessors/iter"
|
6
9
|
|
@@ -21,6 +24,10 @@ module MinitestToRspec
|
|
21
24
|
Subprocessors::Klass.new(exp, @rails, @mocha).process
|
22
25
|
end
|
23
26
|
|
27
|
+
def process_defn(exp)
|
28
|
+
Subprocessors::Defn.new(exp, @rails, @mocha).process
|
29
|
+
end
|
30
|
+
|
24
31
|
def process_iter(exp)
|
25
32
|
Subprocessors::Iter.new(exp, @rails, @mocha).process
|
26
33
|
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../model/defn"
|
4
|
+
require_relative "base"
|
5
|
+
|
6
|
+
module MinitestToRspec
|
7
|
+
module Subprocessors
|
8
|
+
# Minitest tests can be defined as methods using names beginning with 'test_'.
|
9
|
+
# Process those tests into RSpec `it` example blocks.
|
10
|
+
class Defn < Base
|
11
|
+
def initialize(sexp, rails, mocha)
|
12
|
+
super(rails, mocha)
|
13
|
+
@exp = Model::Defn.new(sexp)
|
14
|
+
sexp.clear
|
15
|
+
end
|
16
|
+
|
17
|
+
# Using a `Model::Defn`, returns a `Sexp`
|
18
|
+
def process
|
19
|
+
s(:iter,
|
20
|
+
s(:call, nil, :it, s(:str, example_title)),
|
21
|
+
0,
|
22
|
+
example_block)
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
# Remove 'test_' prefix and replace underscores with spaces
|
28
|
+
def example_title
|
29
|
+
@exp.method_name.sub(/^test_/, '').tr('_', ' ')
|
30
|
+
end
|
31
|
+
|
32
|
+
def example_block
|
33
|
+
block = s(:block)
|
34
|
+
@exp.body.each_with_object(block) do |line, blk|
|
35
|
+
blk << process_line(line)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def process_line(line)
|
40
|
+
::MinitestToRspec::Processor.new(@rails, @mocha).process(line)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
data/lib/minitest_to_rspec.rb
CHANGED
data/minitest_to_rspec.gemspec
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# coding: utf-8
|
2
|
+
# frozen_string_literal: true
|
2
3
|
lib = File.expand_path('../lib', __FILE__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
require 'minitest_to_rspec/version'
|
@@ -21,7 +22,7 @@ A command-line tool for converting minitest files to rspec.
|
|
21
22
|
f.match(%r{^(test|spec|features)/})
|
22
23
|
}
|
23
24
|
spec.require_paths = ["lib"]
|
24
|
-
spec.required_ruby_version = ">= 2.
|
25
|
+
spec.required_ruby_version = ">= 2.3.0"
|
25
26
|
|
26
27
|
spec.add_runtime_dependency "ruby_parser", "~> 3.8"
|
27
28
|
spec.add_runtime_dependency "ruby2ruby", "~> 2.3"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest_to_rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jared Beck
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby_parser
|
@@ -136,8 +136,9 @@ dependencies:
|
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: 0.51.0
|
139
|
-
description:
|
140
|
-
|
139
|
+
description: 'A command-line tool for converting minitest files to rspec.
|
140
|
+
|
141
|
+
'
|
141
142
|
email:
|
142
143
|
- jared@jaredbeck.com
|
143
144
|
executables:
|
@@ -169,6 +170,7 @@ files:
|
|
169
170
|
- lib/minitest_to_rspec/model/calls/once.rb
|
170
171
|
- lib/minitest_to_rspec/model/calls/returns.rb
|
171
172
|
- lib/minitest_to_rspec/model/calls/twice.rb
|
173
|
+
- lib/minitest_to_rspec/model/defn.rb
|
172
174
|
- lib/minitest_to_rspec/model/hash_exp.rb
|
173
175
|
- lib/minitest_to_rspec/model/iter.rb
|
174
176
|
- lib/minitest_to_rspec/model/klass.rb
|
@@ -176,6 +178,7 @@ files:
|
|
176
178
|
- lib/minitest_to_rspec/sexp_assertions.rb
|
177
179
|
- lib/minitest_to_rspec/subprocessors/base.rb
|
178
180
|
- lib/minitest_to_rspec/subprocessors/call.rb
|
181
|
+
- lib/minitest_to_rspec/subprocessors/defn.rb
|
179
182
|
- lib/minitest_to_rspec/subprocessors/iter.rb
|
180
183
|
- lib/minitest_to_rspec/subprocessors/klass.rb
|
181
184
|
- lib/minitest_to_rspec/version.rb
|
@@ -192,7 +195,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
192
195
|
requirements:
|
193
196
|
- - ">="
|
194
197
|
- !ruby/object:Gem::Version
|
195
|
-
version: 2.
|
198
|
+
version: 2.3.0
|
196
199
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
197
200
|
requirements:
|
198
201
|
- - ">="
|