mutant 0.9.2 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Changelog.md +6 -0
- data/Gemfile.lock +1 -2
- data/lib/mutant.rb +1 -2
- data/lib/mutant/config.rb +1 -0
- data/lib/mutant/license.rb +33 -6
- data/lib/mutant/version.rb +1 -1
- data/lib/mutant/warnings.rb +1 -1
- data/mutant.gemspec +2 -3
- data/spec/unit/mutant/license_spec.rb +43 -7
- metadata +4 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88d8955c5d10cb6d884c519e2e9472affa627ab71377f73bd0746f8e27aea1d5
|
4
|
+
data.tar.gz: e4d07470181a24861d61e5f90a107fdcdc6da4f959392bf25c8bf6c8ce1e3628
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6906c7b02d2979d2f666735266a1c7220d75b6af35457ff54b021b3cf5306c1c4b94688eacfb685c46ee554353f91d6a78f6ac999e7535981f162e4b9d312a65
|
7
|
+
data.tar.gz: '059b7da0f47093ec1a7416fd1c3492f3eb01ccd3741796ff4f97ddbf597d2fd37c102c2bacfd5268204115efb6fc428088225d18785e22febfb49ba0d625710c'
|
data/Changelog.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -37,7 +37,7 @@ GIT
|
|
37
37
|
PATH
|
38
38
|
remote: .
|
39
39
|
specs:
|
40
|
-
mutant (0.9.
|
40
|
+
mutant (0.9.3)
|
41
41
|
abstract_type (~> 0.0.7)
|
42
42
|
adamantium (~> 0.2.0)
|
43
43
|
anima (~> 0.3.1)
|
@@ -47,7 +47,6 @@ PATH
|
|
47
47
|
equalizer (~> 0.0.9)
|
48
48
|
ice_nine (~> 0.11.1)
|
49
49
|
memoizable (~> 0.4.2)
|
50
|
-
mutant-license (~> 0.1.0)
|
51
50
|
parser (~> 2.6.5)
|
52
51
|
procto (~> 0.0.2)
|
53
52
|
unparser (~> 0.4.5)
|
data/lib/mutant.rb
CHANGED
@@ -22,8 +22,6 @@ require 'stringio'
|
|
22
22
|
require 'unparser'
|
23
23
|
require 'yaml'
|
24
24
|
|
25
|
-
gem 'mutant-license'
|
26
|
-
|
27
25
|
# This setting is done to make errors within the parallel
|
28
26
|
# reporter / execution visible in the main thread.
|
29
27
|
Thread.abort_on_exception = true
|
@@ -198,6 +196,7 @@ module Mutant
|
|
198
196
|
WORLD = World.new(
|
199
197
|
condition_variable: ConditionVariable,
|
200
198
|
gem: Gem,
|
199
|
+
gem_method: method(:gem),
|
201
200
|
io: IO,
|
202
201
|
json: JSON,
|
203
202
|
kernel: Kernel,
|
data/lib/mutant/config.rb
CHANGED
data/lib/mutant/license.rb
CHANGED
@@ -2,31 +2,58 @@
|
|
2
2
|
|
3
3
|
module Mutant
|
4
4
|
module License
|
5
|
+
NAME = 'mutant-license'
|
6
|
+
VERSION = '~> 0.1.0'
|
7
|
+
SLEEP = 20
|
8
|
+
|
9
|
+
UNLICENSED =
|
10
|
+
IceNine.deep_freeze(
|
11
|
+
[
|
12
|
+
"Soft fail, continuing in #{SLEEP} seconds",
|
13
|
+
'Next major version will enforce the license',
|
14
|
+
'See https://github.com/mbj/mutant#licensing'
|
15
|
+
]
|
16
|
+
)
|
17
|
+
|
5
18
|
def self.apply(world)
|
6
19
|
soft_fail(world, license_result(world))
|
7
20
|
end
|
8
21
|
|
9
22
|
def self.license_result(world)
|
10
|
-
|
23
|
+
load_mutant_license(world)
|
24
|
+
.fmap { license_path(world) }
|
25
|
+
.fmap { |path| Subscription.from_json(world.json.load(path)) }
|
26
|
+
.apply { |sub| sub.apply(world) }
|
11
27
|
end
|
12
28
|
private_class_method :license_result
|
13
29
|
|
14
|
-
|
15
|
-
|
30
|
+
# ignore :reek:NestedIterators
|
31
|
+
def self.soft_fail(world, result)
|
32
|
+
result.lmap do |message|
|
16
33
|
stderr = world.stderr
|
17
34
|
stderr.puts(message)
|
18
|
-
stderr.puts(
|
19
|
-
world.kernel.sleep(
|
35
|
+
UNLICENSED.each { |line| stderr.puts(unlicensed(line)) }
|
36
|
+
world.kernel.sleep(SLEEP)
|
20
37
|
end
|
21
38
|
|
22
39
|
Either::Right.new(true)
|
23
40
|
end
|
24
41
|
private_class_method :soft_fail
|
25
42
|
|
43
|
+
def self.load_mutant_license(world)
|
44
|
+
Either
|
45
|
+
.wrap_error(LoadError) { world.gem_method.call(NAME, VERSION) }
|
46
|
+
.lmap(&method(:unlicensed))
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.unlicensed(message)
|
50
|
+
"[Mutant-License-Error]: #{message}"
|
51
|
+
end
|
52
|
+
|
26
53
|
def self.license_path(world)
|
27
54
|
world
|
28
55
|
.pathname
|
29
|
-
.new(world.gem.loaded_specs.fetch(
|
56
|
+
.new(world.gem.loaded_specs.fetch(NAME).full_gem_path)
|
30
57
|
.join('license.json')
|
31
58
|
end
|
32
59
|
private_class_method :license_path
|
data/lib/mutant/version.rb
CHANGED
data/lib/mutant/warnings.rb
CHANGED
@@ -55,7 +55,7 @@ module Mutant
|
|
55
55
|
# For that reason we do have to use the original method capture to dispatch
|
56
56
|
# in disabled state.
|
57
57
|
#
|
58
|
-
# :reek:
|
58
|
+
# ignore :reek:RepeatedConditional
|
59
59
|
class Warnings
|
60
60
|
# Error raised when warning capture is used recursively
|
61
61
|
class RecursiveUseError < RuntimeError; end
|
data/mutant.gemspec
CHANGED
@@ -7,8 +7,8 @@ Gem::Specification.new do |gem|
|
|
7
7
|
gem.version = Mutant::VERSION.dup
|
8
8
|
gem.authors = ['Markus Schirp']
|
9
9
|
gem.email = ['mbj@schirp-dso.com']
|
10
|
-
gem.description = 'Mutation
|
11
|
-
gem.summary = '
|
10
|
+
gem.description = 'Mutation Testing for Ruby.'
|
11
|
+
gem.summary = ''
|
12
12
|
gem.homepage = 'https://github.com/mbj/mutant'
|
13
13
|
gem.license = 'Nonstandard'
|
14
14
|
|
@@ -30,7 +30,6 @@ Gem::Specification.new do |gem|
|
|
30
30
|
gem.add_runtime_dependency('equalizer', '~> 0.0.9')
|
31
31
|
gem.add_runtime_dependency('ice_nine', '~> 0.11.1')
|
32
32
|
gem.add_runtime_dependency('memoizable', '~> 0.4.2')
|
33
|
-
gem.add_runtime_dependency('mutant-license', '~> 0.1.0')
|
34
33
|
gem.add_runtime_dependency('parser', '~> 2.6.5')
|
35
34
|
gem.add_runtime_dependency('procto', '~> 0.0.2')
|
36
35
|
gem.add_runtime_dependency('unparser', '~> 0.4.5')
|
@@ -6,11 +6,13 @@ RSpec.describe Mutant::License do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
let(:gem) { class_double(Gem, loaded_specs: loaded_specs) }
|
9
|
+
let(:gem_method) { instance_double(Method) }
|
9
10
|
let(:gem_path) { '/path/to/mutant-license' }
|
10
11
|
let(:gem_pathname) { instance_double(Pathname) }
|
11
12
|
let(:json) { class_double(JSON) }
|
12
13
|
let(:kernel) { class_double(Kernel) }
|
13
14
|
let(:license_pathname) { instance_double(Pathname) }
|
15
|
+
let(:load_json) { true }
|
14
16
|
let(:loaded_specs) { { 'mutant-license' => spec } }
|
15
17
|
let(:path) { instance_double(Pathname) }
|
16
18
|
let(:pathname) { class_double(Pathname) }
|
@@ -26,15 +28,17 @@ RSpec.describe Mutant::License do
|
|
26
28
|
let(:world) do
|
27
29
|
instance_double(
|
28
30
|
Mutant::World,
|
29
|
-
gem:
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
31
|
+
gem: gem,
|
32
|
+
gem_method: gem_method,
|
33
|
+
json: json,
|
34
|
+
kernel: kernel,
|
35
|
+
pathname: pathname,
|
36
|
+
stderr: stderr
|
34
37
|
)
|
35
38
|
end
|
36
39
|
|
37
40
|
before do
|
41
|
+
allow(gem_method).to receive_messages(call: undefined)
|
38
42
|
allow(gem_pathname).to receive_messages(join: license_pathname)
|
39
43
|
allow(json).to receive_messages(load: license_json)
|
40
44
|
allow(kernel).to receive_messages(sleep: undefined)
|
@@ -66,6 +70,18 @@ RSpec.describe Mutant::License do
|
|
66
70
|
it 'performs IO in expected sequence' do
|
67
71
|
expect(apply).to eql(Mutant::Either::Right.new(true))
|
68
72
|
|
73
|
+
expect(gem_method)
|
74
|
+
.to have_received(:call)
|
75
|
+
.with('mutant-license', '~> 0.1.0')
|
76
|
+
.ordered
|
77
|
+
|
78
|
+
if load_json
|
79
|
+
expect(json)
|
80
|
+
.to have_received(:load)
|
81
|
+
.with(license_pathname)
|
82
|
+
.ordered
|
83
|
+
end
|
84
|
+
|
69
85
|
expect(stderr)
|
70
86
|
.to have_received(:puts)
|
71
87
|
.with(expected)
|
@@ -73,12 +89,22 @@ RSpec.describe Mutant::License do
|
|
73
89
|
|
74
90
|
expect(stderr)
|
75
91
|
.to have_received(:puts)
|
76
|
-
.with('Soft fail, continuing in
|
92
|
+
.with('[Mutant-License-Error]: Soft fail, continuing in 20 seconds')
|
93
|
+
.ordered
|
94
|
+
|
95
|
+
expect(stderr)
|
96
|
+
.to have_received(:puts)
|
97
|
+
.with('[Mutant-License-Error]: Next major version will enforce the license')
|
98
|
+
.ordered
|
99
|
+
|
100
|
+
expect(stderr)
|
101
|
+
.to have_received(:puts)
|
102
|
+
.with('[Mutant-License-Error]: See https://github.com/mbj/mutant#licensing')
|
77
103
|
.ordered
|
78
104
|
|
79
105
|
expect(kernel)
|
80
106
|
.to have_received(:sleep)
|
81
|
-
.with(
|
107
|
+
.with(20)
|
82
108
|
.ordered
|
83
109
|
end
|
84
110
|
end
|
@@ -253,5 +279,15 @@ RSpec.describe Mutant::License do
|
|
253
279
|
[none]
|
254
280
|
MESSAGE
|
255
281
|
end
|
282
|
+
|
283
|
+
context 'when mutant-license gem cannot be loaded' do
|
284
|
+
let(:load_json) { false }
|
285
|
+
|
286
|
+
before do
|
287
|
+
allow(gem_method).to receive(:call).and_raise(Gem::LoadError, 'test-error')
|
288
|
+
end
|
289
|
+
|
290
|
+
it_fails_with_message '[Mutant-License-Error]: test-error'
|
291
|
+
end
|
256
292
|
end
|
257
293
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mutant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Markus Schirp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: abstract_type
|
@@ -136,20 +136,6 @@ dependencies:
|
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: 0.4.2
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: mutant-license
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - "~>"
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: 0.1.0
|
146
|
-
type: :runtime
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - "~>"
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: 0.1.0
|
153
139
|
- !ruby/object:Gem::Dependency
|
154
140
|
name: parser
|
155
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -220,7 +206,7 @@ dependencies:
|
|
220
206
|
- - "~>"
|
221
207
|
- !ruby/object:Gem::Version
|
222
208
|
version: '1.3'
|
223
|
-
description: Mutation
|
209
|
+
description: Mutation Testing for Ruby.
|
224
210
|
email:
|
225
211
|
- mbj@schirp-dso.com
|
226
212
|
executables:
|
@@ -630,7 +616,7 @@ requirements: []
|
|
630
616
|
rubygems_version: 3.0.3
|
631
617
|
signing_key:
|
632
618
|
specification_version: 4
|
633
|
-
summary:
|
619
|
+
summary: ''
|
634
620
|
test_files:
|
635
621
|
- spec/integration/mutant/corpus_spec.rb
|
636
622
|
- spec/integration/mutant/isolation/fork_spec.rb
|