mutator_rails 0.1.15 → 0.1.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +11 -1
- data/Gemfile.lock +4 -4
- data/lib/mutator_rails/full_mutate.rb +40 -3
- data/lib/mutator_rails/guide.rb +5 -3
- data/lib/mutator_rails/single_mutate.rb +15 -5
- data/lib/mutator_rails/version.rb +1 -1
- data/lib/tasks/mutator/mutate_files.rake +15 -0
- data/lib/tasks/mutator/mutator.rake +1 -1
- data/spec/mutator_rails/full_mutate_spec.rb +19 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8e113d0cde42730e0cf1e6f528048a94fe100636
|
4
|
+
data.tar.gz: 3222b00262fe86b23db2f383b9cfcd23cb161945
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6473c439f0672810f9a84001295b2781d0c5d79e544eedfe88ce7140c50cca625be1e894d9ae4cdb941567620da843ff49789c50d283680642af02e9ceb168b
|
7
|
+
data.tar.gz: 6eae2475fd45345a37704b4320704cb66b2ae05f35a09eecc25633979c814c9eb04dc9963c4dcd4e038a83e8d4030fdf2eaf3dd757580cda999a0caad4974d4e
|
data/CHANGELOG.md
CHANGED
@@ -8,6 +8,16 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
|
|
8
8
|
|
9
9
|
### Added
|
10
10
|
|
11
|
+
### Changed
|
12
|
+
|
13
|
+
### Removed
|
14
|
+
|
15
|
+
## [0.1.17] - 2020-07-31
|
16
|
+
|
17
|
+
_NB: Some of the changes below were released in versions not reflected in this Changelog. This entry brings us up to date._
|
18
|
+
|
19
|
+
### Added
|
20
|
+
|
11
21
|
- Add -j1 fallback and failure tracking to statistics.
|
12
22
|
[I50](https://github.com/dinj-oss/mutator_rails/issues/50) [PR49](https://github.com/dinj-oss/mutator_rails/pull/49)
|
13
23
|
|
@@ -55,7 +65,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
|
|
55
65
|
|
56
66
|
- Added this changelog.
|
57
67
|
[I41](https://github.com/dinj-oss/mutator_rails/issues/41) [PR40](https://github.com/dinj-oss/mutator_rails/pull/40)
|
58
|
-
|
68
|
+
|
59
69
|
- Updated Nokogiri gem to 1.8.1 to address a security vulnerability.
|
60
70
|
[I38](https://github.com/dinj-oss/mutator_rails/issues/38) [PR42](https://github.com/dinj-oss/mutator_rails/pull/42)
|
61
71
|
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
mutator_rails (0.1.
|
4
|
+
mutator_rails (0.1.17)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -84,7 +84,7 @@ GEM
|
|
84
84
|
i18n (1.6.0)
|
85
85
|
concurrent-ruby (~> 1.0)
|
86
86
|
ice_nine (0.11.2)
|
87
|
-
json (2.1
|
87
|
+
json (2.3.1)
|
88
88
|
loofah (2.3.1)
|
89
89
|
crass (~> 1.0.2)
|
90
90
|
nokogiri (>= 1.5.9)
|
@@ -134,7 +134,7 @@ GEM
|
|
134
134
|
parser (2.4.0.0)
|
135
135
|
ast (~> 2.2)
|
136
136
|
procto (0.0.3)
|
137
|
-
rack (2.
|
137
|
+
rack (2.2.3)
|
138
138
|
rack-test (1.1.0)
|
139
139
|
rack (>= 1.0, < 3)
|
140
140
|
rails (5.2.2.1)
|
@@ -214,7 +214,7 @@ GEM
|
|
214
214
|
equalizer (~> 0.0, >= 0.0.9)
|
215
215
|
websocket-driver (0.7.0)
|
216
216
|
websocket-extensions (>= 0.1.0)
|
217
|
-
websocket-extensions (0.1.
|
217
|
+
websocket-extensions (0.1.5)
|
218
218
|
|
219
219
|
PLATFORMS
|
220
220
|
ruby
|
@@ -13,21 +13,58 @@ module MutatorRails
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def call
|
16
|
-
|
16
|
+
process(all_files)
|
17
|
+
end
|
18
|
+
|
19
|
+
def unprocessed
|
20
|
+
process(unprocessed_files)
|
21
|
+
end
|
22
|
+
|
23
|
+
def j1
|
24
|
+
process(j1_files)
|
25
|
+
end
|
26
|
+
|
27
|
+
def changed
|
28
|
+
process(all_files - unprocessed_files - j1_files)
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def unprocessed_files
|
34
|
+
all_files.select do |file|
|
35
|
+
sm = SingleMutate.new(guide, file)
|
36
|
+
!exclude?(file) && !guide.log_exists?(sm.log)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def j1_files
|
41
|
+
all_files.select do |file|
|
42
|
+
sm = SingleMutate.new(guide, file)
|
43
|
+
!exclude?(file) && sm.need_j1?
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def process(files)
|
48
|
+
files.sort_by { |x| File.size(x) }.each do |file|
|
17
49
|
next if exclude?(file)
|
18
50
|
|
19
51
|
SingleMutate.new(guide, file).call
|
20
52
|
end
|
21
53
|
end
|
22
54
|
|
23
|
-
|
55
|
+
def all_files
|
56
|
+
Dir.glob(APP_BASE + '**/*.rb')
|
57
|
+
end
|
24
58
|
|
25
59
|
def excluded_files
|
26
60
|
@exclusions ||= load_exclusions
|
27
61
|
end
|
28
62
|
|
29
63
|
def load_exclusions
|
30
|
-
MutatorRails::Config.configuration
|
64
|
+
MutatorRails::Config.configuration
|
65
|
+
.exclusions
|
66
|
+
.compact
|
67
|
+
.flat_map { |exclusion| Dir.glob(exclusion) }
|
31
68
|
end
|
32
69
|
|
33
70
|
def exclude?(file)
|
data/lib/mutator_rails/guide.rb
CHANGED
@@ -15,7 +15,7 @@ module MutatorRails
|
|
15
15
|
# p guides[log]
|
16
16
|
File.exist?(log) &&
|
17
17
|
File.size(log).positive? &&
|
18
|
-
|
18
|
+
log_exists?(log) &&
|
19
19
|
guides[log].eql?([code_md5, spec_md5, MUTANT_VERSION])
|
20
20
|
end
|
21
21
|
|
@@ -24,6 +24,10 @@ module MutatorRails
|
|
24
24
|
recreate
|
25
25
|
end
|
26
26
|
|
27
|
+
def log_exists?(log)
|
28
|
+
guides[log].present?
|
29
|
+
end
|
30
|
+
|
27
31
|
def remove(log)
|
28
32
|
guides.delete(log)
|
29
33
|
recreate
|
@@ -63,7 +67,5 @@ module MutatorRails
|
|
63
67
|
FileUtils.mkdir_p(p.dirname)
|
64
68
|
end
|
65
69
|
end
|
66
|
-
|
67
|
-
|
68
70
|
end
|
69
71
|
end
|
@@ -13,8 +13,7 @@ module MutatorRails
|
|
13
13
|
parms << '1> ' + log.to_s
|
14
14
|
log_dir
|
15
15
|
|
16
|
-
cmd
|
17
|
-
rerun(cmd)
|
16
|
+
rerun(cmd(parms)) || first_run(parms)
|
18
17
|
end
|
19
18
|
|
20
19
|
def log
|
@@ -23,7 +22,7 @@ module MutatorRails
|
|
23
22
|
guide.update(full_log, code_md5, spec_md5)
|
24
23
|
File.rename(old_log, full_log)
|
25
24
|
end
|
26
|
-
|
25
|
+
|
27
26
|
full_log
|
28
27
|
end
|
29
28
|
|
@@ -74,8 +73,15 @@ module MutatorRails
|
|
74
73
|
`#{cmd2}` unless ENV['RACK_ENV'].eql?('test')
|
75
74
|
end
|
76
75
|
|
76
|
+
def need_j1?
|
77
|
+
return false unless File.exist?(log)
|
78
|
+
|
79
|
+
content = File.read(log)
|
80
|
+
/Failures:/ === content
|
81
|
+
end
|
82
|
+
|
77
83
|
def first_run(parms)
|
78
|
-
cmd =
|
84
|
+
cmd = cmd(parms)
|
79
85
|
|
80
86
|
if changed? || !complete?(log) || failed?(log)
|
81
87
|
puts "[#{Time.current.iso8601}] #{cmd}"
|
@@ -86,6 +92,10 @@ module MutatorRails
|
|
86
92
|
cmd
|
87
93
|
end
|
88
94
|
|
95
|
+
def cmd(parms)
|
96
|
+
spec_opt + COMMAND + parms.join(' ')
|
97
|
+
end
|
98
|
+
|
89
99
|
def spec_opt
|
90
100
|
"SPEC_OPTS=\"--pattern #{spec_file}\" "
|
91
101
|
end
|
@@ -123,7 +133,7 @@ module MutatorRails
|
|
123
133
|
end
|
124
134
|
|
125
135
|
private
|
126
|
-
|
136
|
+
|
127
137
|
def changed?
|
128
138
|
!log_correct?
|
129
139
|
end
|
@@ -8,5 +8,20 @@ if Rails.env.development? || Rails.env.test?
|
|
8
8
|
task :files do
|
9
9
|
MutatorRails::FullMutate.call
|
10
10
|
end
|
11
|
+
|
12
|
+
desc 'Run mutation tests on the unprocessed file set'
|
13
|
+
task :unprocessed_files do
|
14
|
+
MutatorRails::FullMutate.new.unprocessed
|
15
|
+
end
|
16
|
+
|
17
|
+
desc 'Run mutation tests on the j1 file set'
|
18
|
+
task :j1_files do
|
19
|
+
MutatorRails::FullMutate.new.j1
|
20
|
+
end
|
21
|
+
|
22
|
+
desc 'Run mutation tests on the changed file set'
|
23
|
+
task :changed_files do
|
24
|
+
MutatorRails::FullMutate.new.changed
|
25
|
+
end
|
11
26
|
end
|
12
27
|
end
|
@@ -10,7 +10,7 @@ if Rails.env.development? || Rails.env.test?
|
|
10
10
|
|
11
11
|
namespace :mutator do
|
12
12
|
desc 'Run whole mutation process'
|
13
|
-
task all: %i[files cleanup analyze statistics] do
|
13
|
+
task all: %i[unprocessed_files changed_files j1_files files cleanup analyze statistics] do
|
14
14
|
puts 'all processed!'
|
15
15
|
end
|
16
16
|
end
|
@@ -6,8 +6,26 @@ RSpec.describe MutatorRails::FullMutate do
|
|
6
6
|
let(:object) { described_class.call }
|
7
7
|
|
8
8
|
describe '#call' do
|
9
|
-
it 'processes
|
9
|
+
it 'processes all code' do
|
10
10
|
object
|
11
11
|
end
|
12
12
|
end
|
13
|
+
|
14
|
+
describe '#unprocessed' do
|
15
|
+
it 'processes the unprocessed code' do
|
16
|
+
described_class.new.unprocessed
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe '#j1' do
|
21
|
+
it 'processes the j1 code' do
|
22
|
+
described_class.new.j1
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe '#changed' do
|
27
|
+
it 'processes the changed code' do
|
28
|
+
described_class.new.changed
|
29
|
+
end
|
30
|
+
end
|
13
31
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mutator_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Chambers
|
8
8
|
- Jason Dinsmore
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-07-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionview
|
@@ -326,7 +326,7 @@ homepage: https://github.com/hintmedia/mutator_rails
|
|
326
326
|
licenses:
|
327
327
|
- MIT
|
328
328
|
metadata: {}
|
329
|
-
post_install_message:
|
329
|
+
post_install_message:
|
330
330
|
rdoc_options: []
|
331
331
|
require_paths:
|
332
332
|
- lib
|
@@ -341,8 +341,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
341
341
|
- !ruby/object:Gem::Version
|
342
342
|
version: 1.3.6
|
343
343
|
requirements: []
|
344
|
-
|
345
|
-
|
344
|
+
rubyforge_project:
|
345
|
+
rubygems_version: 2.5.2
|
346
|
+
signing_key:
|
346
347
|
specification_version: 4
|
347
348
|
summary: Integrate automated mutation testing into Rails.
|
348
349
|
test_files: []
|