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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7dfd012dc992fee0a64b3310e03860db713af72c
4
- data.tar.gz: c71cbc4244fd4a86c54199cd0260e661ea1fffff
3
+ metadata.gz: '079eae592894615cc1b10834116d5b0e02db3a04'
4
+ data.tar.gz: b50df3b0e24960b4877518c354cbee368c91528d
5
5
  SHA512:
6
- metadata.gz: b0d5dd27c5e125d83468062099fc91d0b1da02583088902b1aa415a6a54db35fd26b9ff399708e4ea818c2ab9054ab8e2418bb253ad2cbcbe5d79f0c1c4fc283
7
- data.tar.gz: fcda174e34b5e8e3118b2662eb1d1cf3a4a6801bd75be0b6cc7f73628b6bfaf40159164f75012c0e4fababf6352736df3e979db4bbe4adddb301a50f7ba2d64a
6
+ metadata.gz: 4a637880b785137bc6c49bcc4b87f87f0f9ae3fbf91897627e4b3e8cd1b399e1e65d1d999114e697fd96b7350b1a2dd9917c6f9225b943db5ff32fb436b401bb
7
+ data.tar.gz: c31792040f37beac13d3e19cfeb3c1095577f790fdaceda9e8b34d612e048fc8f7353005af83e86514e7d5b23f960da158a1c7172a94c64ebddb28d04b12c932
data/.rubocop.yml CHANGED
@@ -3,4 +3,4 @@ inherit_from: .rubocop_todo.yml
3
3
  AllCops:
4
4
  Exclude:
5
5
  - spec/fixtures/**/*
6
- TargetRubyVersion: 2.2
6
+ TargetRubyVersion: 2.3
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-10-24 17:20:57 -0400 using RuboCop version 0.51.0.
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: 5
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: 335
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
@@ -1,6 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
- - "2.2.8"
4
3
  - "2.3.5"
5
4
  - "2.4.2"
6
5
  script: bundle exec rake
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.9.0 (2017-10-24)
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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in minitest_to_rspec.gemspec
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rspec/core/rake_task'
2
4
  require 'rubocop/rake_task'
3
5
 
data/bin/console CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require "bundler/setup"
4
5
  require "minitest_to_rspec"
data/bin/mt2rspec CHANGED
@@ -1,3 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  require "minitest_to_rspec/cli"
3
5
  MinitestToRspec::CLI.new(ARGV).run
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "fileutils"
2
4
  require "minitest_to_rspec"
3
5
  require "trollop"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "ruby_parser"
2
4
  require "ruby2ruby"
3
5
  require_relative "processor"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module MinitestToRspec
2
4
  class Error < StandardError; end
3
5
  class ProcessingError < Error; end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative "../sexp_assertions"
2
4
 
3
5
  module MinitestToRspec
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative "base"
2
4
 
3
5
  module MinitestToRspec
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative "../call"
2
4
  require_relative "../../errors"
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative "../call"
2
4
  require_relative "../../errors"
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative "../call"
2
4
  require_relative "../../errors"
3
5
 
@@ -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,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module MinitestToRspec
2
4
  module Model
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative "base"
2
4
 
3
5
  module MinitestToRspec
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative "base"
2
4
 
3
5
  module MinitestToRspec
@@ -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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module MinitestToRspec
2
4
 
3
5
  # Useful runtime assertions regarding S-expressions.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative "../sexp_assertions"
2
4
 
3
5
  module MinitestToRspec
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative "../model/call"
2
4
  require_relative "../model/calls/returns"
3
5
  require_relative "../model/hash_exp"
@@ -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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative "base"
2
4
  require_relative "../model/iter"
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative "../errors"
2
4
  require_relative "../model/klass"
3
5
  require_relative "base"
@@ -1,3 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ #:nodoc:
1
4
  module MinitestToRspec
2
- VERSION = "0.9.0".freeze
5
+ VERSION = "0.10.0"
6
+
7
+ def self.gem_version
8
+ ::Gem::Version.new(VERSION)
9
+ end
3
10
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "minitest_to_rspec/version"
2
4
  require "minitest_to_rspec/converter"
3
5
 
@@ -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.2.0"
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.9.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-10-24 00:00:00.000000000 Z
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
- A command-line tool for converting minitest files to rspec.
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.2.0
198
+ version: 2.3.0
196
199
  required_rubygems_version: !ruby/object:Gem::Requirement
197
200
  requirements:
198
201
  - - ">="