minitest_to_rspec 0.12.0 → 0.13.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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b6e110f3ca9c10dfbc0b55d64f91132df5367984b3b484b6fa5a12dc5fe63ca
|
4
|
+
data.tar.gz: dfbd9d42cdd3382f1abb9c84d6a9ac0b45e3aec4c9554203248efca6f01064b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ed6c1df443a56e96b11095962298660cc0826cf709c0c3be628bcc49cbcc8a918cbb12b6904c3bbe67b84b665e0c44db5c599e215ee44302330f14eca9bd317
|
7
|
+
data.tar.gz: 66d2051676eb5755589504a8b12f66990eccd37bdcb0e6755d4500e3f75857187479e78b46ed09ff155c5201331cb72dd2eea809542dbfcaa5fe467a8ea49b52
|
data/CHANGELOG.md
CHANGED
@@ -17,6 +17,23 @@ of [keepachangelog.com][2].
|
|
17
17
|
|
18
18
|
- None
|
19
19
|
|
20
|
+
## 0.13.0 (2018-10-18)
|
21
|
+
|
22
|
+
### Breaking Changes
|
23
|
+
|
24
|
+
- Removed `MinitestToRspec::VERSION`, please use `MinitestToRspec.gem_version`
|
25
|
+
|
26
|
+
### Added
|
27
|
+
|
28
|
+
- [#26](https://github.com/jaredbeck/minitest_to_rspec/pull/26) -
|
29
|
+
Support `Test::Unit::TestCase`
|
30
|
+
- [#25](https://github.com/jaredbeck/minitest_to_rspec/pull/25) -
|
31
|
+
Support `assert_empty`, `assert_kind_of`, `assert_instance_of`
|
32
|
+
|
33
|
+
### Fixed
|
34
|
+
|
35
|
+
- None
|
36
|
+
|
20
37
|
## 0.12.0 (2018-03-11)
|
21
38
|
|
22
39
|
### Breaking Changes
|
@@ -32,13 +32,7 @@ module MinitestToRspec
|
|
32
32
|
attr_reader :source, :target
|
33
33
|
|
34
34
|
def initialize(args)
|
35
|
-
opts =
|
36
|
-
version MinitestToRspec::VERSION
|
37
|
-
banner BANNER
|
38
|
-
opt :rails, OPT_RAILS, short: :none
|
39
|
-
opt :mocha, OPT_MOCHA, short: :none
|
40
|
-
end
|
41
|
-
|
35
|
+
opts = parse_args(args)
|
42
36
|
@rails = opts[:rails]
|
43
37
|
@mocha = opts[:mocha]
|
44
38
|
case args.length
|
@@ -101,6 +95,15 @@ module MinitestToRspec
|
|
101
95
|
.gsub(/_test.rb\Z/, '_spec.rb')
|
102
96
|
end
|
103
97
|
|
98
|
+
def parse_args(args)
|
99
|
+
Trollop.options(args) do
|
100
|
+
version MinitestToRspec.gem_version.to_s
|
101
|
+
banner BANNER
|
102
|
+
opt :rails, OPT_RAILS, short: :none
|
103
|
+
opt :mocha, OPT_MOCHA, short: :none
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
104
107
|
def read_source
|
105
108
|
File.read(source)
|
106
109
|
end
|
@@ -45,6 +45,10 @@ module MinitestToRspec
|
|
45
45
|
@_block ||= @exp[3..-1] || []
|
46
46
|
end
|
47
47
|
|
48
|
+
def test_unit_test_case?
|
49
|
+
lineage?(parent, %i[Test Unit TestCase])
|
50
|
+
end
|
51
|
+
|
48
52
|
def draper_test_case?
|
49
53
|
lineage?(parent, %i[Draper TestCase])
|
50
54
|
end
|
@@ -78,23 +82,24 @@ module MinitestToRspec
|
|
78
82
|
active_support_test_case? ||
|
79
83
|
action_controller_test_case? ||
|
80
84
|
action_mailer_test_case? ||
|
85
|
+
test_unit_test_case? ||
|
81
86
|
draper_test_case?
|
82
87
|
end
|
83
88
|
|
84
89
|
private
|
85
90
|
|
86
|
-
def
|
87
|
-
|
88
|
-
|
89
|
-
sexp_type?(:
|
91
|
+
def ancestor_names(exp)
|
92
|
+
return [exp] if exp.is_a?(Symbol)
|
93
|
+
|
94
|
+
sexp_type?(:colon2, exp) || sexp_type?(:const, exp) ||
|
95
|
+
raise(TypeError, "Expected :const or :colon2, got #{exp.inspect}")
|
96
|
+
|
97
|
+
exp.sexp_body.flat_map { |entry| ancestor_names(entry) }
|
90
98
|
end
|
91
99
|
|
92
100
|
def lineage?(exp, names)
|
93
101
|
assert_sexp_type(:colon2, exp)
|
94
|
-
exp
|
95
|
-
names.each_with_index.all? { |name, ix|
|
96
|
-
name.to_sym == ancestor_name(exp, ix).to_sym
|
97
|
-
}
|
102
|
+
ancestor_names(exp) == names
|
98
103
|
end
|
99
104
|
end
|
100
105
|
end
|
@@ -55,10 +55,22 @@ module MinitestToRspec
|
|
55
55
|
matcher(:be_nil)
|
56
56
|
end
|
57
57
|
|
58
|
+
def be_empty
|
59
|
+
matcher(:be_empty)
|
60
|
+
end
|
61
|
+
|
58
62
|
def be_truthy
|
59
63
|
matcher(:be_truthy)
|
60
64
|
end
|
61
65
|
|
66
|
+
def be_a(exp)
|
67
|
+
matcher(:be_a, exp)
|
68
|
+
end
|
69
|
+
|
70
|
+
def be_instance_of(exp)
|
71
|
+
matcher(:be_instance_of, exp)
|
72
|
+
end
|
73
|
+
|
62
74
|
def call_to_question_mark?(exp)
|
63
75
|
sexp_type?(:call, exp) && Model::Call.new(exp).question_mark_method?
|
64
76
|
end
|
@@ -95,12 +107,28 @@ module MinitestToRspec
|
|
95
107
|
expect_to_not(be_nil, @exp.arguments[0], true)
|
96
108
|
end
|
97
109
|
|
110
|
+
def method_assert_empty
|
111
|
+
expect_to(be_empty, @exp.arguments[0], true)
|
112
|
+
end
|
113
|
+
|
98
114
|
def method_assert_not_equal
|
99
115
|
expected = @exp.arguments[0]
|
100
116
|
calculated = @exp.arguments[1]
|
101
117
|
expect_to_not(eq(expected), calculated, true)
|
102
118
|
end
|
103
119
|
|
120
|
+
def method_assert_kind_of
|
121
|
+
expected = @exp.arguments[0]
|
122
|
+
calculated = @exp.arguments[1]
|
123
|
+
expect_to(be_a(expected), calculated, true)
|
124
|
+
end
|
125
|
+
|
126
|
+
def method_assert_instance_of
|
127
|
+
expected = @exp.arguments[0]
|
128
|
+
calculated = @exp.arguments[1]
|
129
|
+
expect_to(be_instance_of(expected), calculated, true)
|
130
|
+
end
|
131
|
+
|
104
132
|
def method_expects
|
105
133
|
if @exp.num_arguments == 1 &&
|
106
134
|
%i[lit hash].include?(@exp.arguments.first.sexp_type)
|
data/minitest_to_rspec.gemspec
CHANGED
@@ -6,7 +6,7 @@ require 'minitest_to_rspec/version'
|
|
6
6
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
8
|
spec.name = 'minitest_to_rspec'
|
9
|
-
spec.version = MinitestToRspec
|
9
|
+
spec.version = MinitestToRspec.gem_version.to_s
|
10
10
|
spec.executables << 'mt2rspec'
|
11
11
|
spec.authors = ['Jared Beck']
|
12
12
|
spec.email = ['jared@jaredbeck.com']
|
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.13.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: 2018-
|
11
|
+
date: 2018-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby2ruby
|