mutator_rails 0.1.8

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.
Files changed (52) hide show
  1. checksums.yaml +7 -0
  2. data/.circleci/config.yml +37 -0
  3. data/.codeclimate.yml +20 -0
  4. data/.gitignore +12 -0
  5. data/.rspec +2 -0
  6. data/.ruby-version +1 -0
  7. data/CODE_OF_CONDUCT.md +46 -0
  8. data/Gemfile +7 -0
  9. data/Gemfile.lock +232 -0
  10. data/LICENSE.md +21 -0
  11. data/README.md +31 -0
  12. data/Rakefile +8 -0
  13. data/app/models/test.rb +7 -0
  14. data/bin/console +15 -0
  15. data/bin/setup +8 -0
  16. data/config/mutator_rails.yml +8 -0
  17. data/defaults.reek +131 -0
  18. data/lib/mutator_rails.rb +33 -0
  19. data/lib/mutator_rails/analyze.rb +27 -0
  20. data/lib/mutator_rails/cleanup.rb +60 -0
  21. data/lib/mutator_rails/config.rb +34 -0
  22. data/lib/mutator_rails/full_mutate.rb +39 -0
  23. data/lib/mutator_rails/guide.rb +69 -0
  24. data/lib/mutator_rails/list_maker.rb +25 -0
  25. data/lib/mutator_rails/mutation_log.rb +112 -0
  26. data/lib/mutator_rails/railtie.rb +18 -0
  27. data/lib/mutator_rails/single_mutate.rb +134 -0
  28. data/lib/mutator_rails/statistics.rb +192 -0
  29. data/lib/mutator_rails/version.rb +5 -0
  30. data/lib/tasks/mutator/analyze.rake +13 -0
  31. data/lib/tasks/mutator/cleanup.rake +13 -0
  32. data/lib/tasks/mutator/mutate_files.rake +12 -0
  33. data/lib/tasks/mutator/mutator.rake +17 -0
  34. data/lib/tasks/mutator/statistics.rake +13 -0
  35. data/log/mutant/analysis.tsv +3 -0
  36. data/log/mutant/guide.txt +1 -0
  37. data/log/mutant/models/test.log +92 -0
  38. data/log/mutant/models/test2.log +92 -0
  39. data/log/mutant/statistics.txt +19 -0
  40. data/mutator_rails.gemspec +37 -0
  41. data/spec/models/test_spec.rb +15 -0
  42. data/spec/mutator_rails/analyze_spec.rb +26 -0
  43. data/spec/mutator_rails/cleanup_spec.rb +13 -0
  44. data/spec/mutator_rails/full_mutate_spec.rb +13 -0
  45. data/spec/mutator_rails/guide_spec.rb +33 -0
  46. data/spec/mutator_rails/list_maker_spec.rb +17 -0
  47. data/spec/mutator_rails/mutation_log_spec.rb +36 -0
  48. data/spec/mutator_rails/single_mutate_spec.rb +111 -0
  49. data/spec/mutator_rails/statistics_spec.rb +48 -0
  50. data/spec/mutator_rails_spec.rb +9 -0
  51. data/spec/spec_helper.rb +49 -0
  52. metadata +306 -0
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module MutatorRails
4
+ VERSION = '0.1.8'
5
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ if Rails.env.development? || Rails.env.test?
4
+
5
+ namespace :mutator do
6
+ require Rails.root.join('config/environment.rb')
7
+
8
+ desc 'Run mutation analysis on the mutant logs'
9
+ task :analyze do
10
+ MutatorRails::Analyze.call
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ if Rails.env.development? || Rails.env.test?
4
+
5
+ namespace :mutator do
6
+ require Rails.root.join('config/environment.rb')
7
+
8
+ desc 'Cleanup stale logs'
9
+ task :cleanup do
10
+ MutatorRails::Cleanup.call
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ if Rails.env.development? || Rails.env.test?
4
+ namespace :mutator do
5
+ require Rails.root.join('config/environment.rb')
6
+
7
+ desc 'Run mutation tests on the full file set'
8
+ task :files do
9
+ MutatorRails::FullMutate.call
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'etc'
4
+ require 'yaml'
5
+ require 'json'
6
+ require 'ostruct'
7
+ require 'fileutils'
8
+
9
+ if Rails.env.development? || Rails.env.test?
10
+
11
+ namespace :mutator do
12
+ desc 'Run whole mutation process'
13
+ task all: %i[files analyze statistics cleanup] do
14
+ puts 'all processed!'
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ if Rails.env.development? || Rails.env.test?
4
+
5
+ namespace :mutator do
6
+ require Rails.root.join('config/environment.rb')
7
+
8
+ desc 'Run mutation statistics on the mutant logs'
9
+ task :statistics do
10
+ MutatorRails::Statistics.call
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,3 @@
1
+ log kills alive total pct killed mutations per sec runtime
2
+ =HYPERLINK("models/test.log","Export::ActivityExporter") 73 26 99 73.737 1.559 63.52
3
+ =HYPERLINK("models/test2.log","Export::ActivityExporter2") 73 26 99 73.737 1.559 63.52
@@ -0,0 +1 @@
1
+ log/mutant/models/test.log | fdef5a515ce8eff897a72b026aadbaba | 0e7f4802f58bbbb186be8b44a74a33e3 | 0.8.14
@@ -0,0 +1,92 @@
1
+ Module#name from: XPath::HTML returned name(.). Fix your lib to follow normal ruby semantics!
2
+ {Module,Class}#name should return resolvable constant name as String or nil
3
+ Module#name from: XPath returned name(.). Fix your lib to follow normal ruby semantics!
4
+ {Module,Class}#name should return resolvable constant name as String or nil
5
+ Mutant configuration:
6
+ Matcher: #<Mutant::Matcher::Config match_expressions: [Export::ActivityExporter]>
7
+ Integration: Mutant::Integration::Rspec
8
+ Jobs: 6
9
+ Includes: []
10
+ Requires: ["./config/environment.rb"]
11
+ (00/99) 100% - killtime: 0.00s runtime: 0.00s overhead: 0.00s
12
+ (00/99) 100% - killtime: 0.00s runtime: 1.01s overhead: 1.01s
13
+ (00/99) 100% - killtime: 0.00s runtime: 2.02s overhead: 2.02s
14
+ (00/99) 100% - killtime: 0.00s runtime: 3.03s overhead: 3.03s
15
+ (06/99) 100% - killtime: 20.02s runtime: 4.04s overhead: -15.98s
16
+ (06/99) 100% - killtime: 20.02s runtime: 5.04s overhead: -14.98s
17
+ (06/99) 100% - killtime: 20.02s runtime: 6.05s overhead: -13.97s
18
+ (07/99) 100% - killtime: 23.37s runtime: 7.05s overhead: -16.32s
19
+ (12/99) 100% - killtime: 40.64s runtime: 8.06s overhead: -32.58s
20
+ (12/99) 100% - killtime: 40.64s runtime: 9.07s overhead: -31.57s
21
+ (12/99) 100% - killtime: 40.64s runtime: 10.08s overhead: -30.56s
22
+ (18/99) 100% - killtime: 61.69s runtime: 11.09s overhead: -50.60s
23
+ (18/99) 100% - killtime: 61.69s runtime: 12.09s overhead: -49.59s
24
+ (18/99) 100% - killtime: 61.69s runtime: 13.10s overhead: -48.59s
25
+ (18/99) 100% - killtime: 61.69s runtime: 14.11s overhead: -47.58s
26
+ (24/99) 100% - killtime: 81.67s runtime: 15.12s overhead: -66.55s
27
+ (24/99) 100% - killtime: 81.67s runtime: 16.13s overhead: -65.54s
28
+ (24/99) 100% - killtime: 81.67s runtime: 17.15s overhead: -64.52s
29
+ (28/99) 100% - killtime: 95.46s runtime: 18.16s overhead: -77.30s
30
+ (28/99) 93% - killtime: 103.04s runtime: 19.16s overhead: -83.88s
31
+ (28/99) 93% - killtime: 103.04s runtime: 20.17s overhead: -82.87s
32
+ (28/99) 93% - killtime: 103.04s runtime: 21.18s overhead: -81.86s
33
+ (30/99) 88% - killtime: 117.44s runtime: 22.19s overhead: -95.25s
34
+ (30/99) 83% - killtime: 125.24s runtime: 23.20s overhead: -102.04s
35
+ (30/99) 83% - killtime: 125.24s runtime: 24.20s overhead: -101.04s
36
+ (31/99) 83% - killtime: 128.75s runtime: 25.21s overhead: -103.54s
37
+ (33/99) 82% - killtime: 139.71s runtime: 26.22s overhead: -113.49s
38
+ (33/99) 78% - killtime: 147.26s runtime: 27.23s overhead: -120.03s
39
+ (33/99) 78% - killtime: 147.26s runtime: 28.24s overhead: -119.03s
40
+ (33/99) 78% - killtime: 147.26s runtime: 29.25s overhead: -118.02s
41
+ (35/99) 77% - killtime: 159.20s runtime: 30.25s overhead: -128.95s
42
+ (38/99) 79% - killtime: 171.71s runtime: 31.27s overhead: -140.44s
43
+ (38/99) 79% - killtime: 171.71s runtime: 32.27s overhead: -139.43s
44
+ (38/99) 79% - killtime: 171.71s runtime: 33.28s overhead: -138.42s
45
+ (41/99) 80% - killtime: 184.03s runtime: 34.29s overhead: -149.74s
46
+ (44/99) 81% - killtime: 195.63s runtime: 35.30s overhead: -160.33s
47
+ (44/99) 81% - killtime: 195.63s runtime: 36.31s overhead: -159.33s
48
+ (44/99) 81% - killtime: 195.63s runtime: 37.31s overhead: -158.32s
49
+ (46/99) 80% - killtime: 206.66s runtime: 38.32s overhead: -168.34s
50
+ (46/99) 76% - killtime: 217.97s runtime: 39.33s overhead: -178.65s
51
+ (46/99) 76% - killtime: 217.97s runtime: 40.33s overhead: -177.64s
52
+ (46/99) 75% - killtime: 221.72s runtime: 41.34s overhead: -180.38s
53
+ (50/99) 76% - killtime: 235.68s runtime: 42.34s overhead: -193.34s
54
+ (51/99) 77% - killtime: 239.21s runtime: 43.35s overhead: -195.85s
55
+ (51/99) 77% - killtime: 239.21s runtime: 44.36s overhead: -194.85s
56
+ (53/99) 77% - killtime: 246.10s runtime: 45.37s overhead: -200.73s
57
+ (53/99) 74% - killtime: 257.73s runtime: 46.39s overhead: -211.35s
58
+ (53/99) 73% - killtime: 261.44s runtime: 47.39s overhead: -214.05s
59
+ (53/99) 73% - killtime: 261.44s runtime: 48.40s overhead: -213.03s
60
+ (55/99) 73% - killtime: 271.98s runtime: 49.41s overhead: -222.57s
61
+ (56/99) 72% - killtime: 279.21s runtime: 50.42s overhead: -228.79s
62
+ (56/99) 71% - killtime: 282.94s runtime: 51.43s overhead: -231.52s
63
+ (56/99) 71% - killtime: 282.94s runtime: 52.43s overhead: -230.52s
64
+ (59/99) 72% - killtime: 293.60s runtime: 53.44s overhead: -240.17s
65
+ (62/99) 73% - killtime: 304.24s runtime: 54.44s overhead: -249.80s
66
+ (62/99) 73% - killtime: 304.24s runtime: 55.45s overhead: -248.79s
67
+ (63/99) 73% - killtime: 311.21s runtime: 56.46s overhead: -254.75s
68
+ (64/99) 72% - killtime: 318.20s runtime: 57.47s overhead: -260.73s
69
+ (65/99) 72% - killtime: 325.37s runtime: 58.48s overhead: -266.89s
70
+ (65/99) 72% - killtime: 325.37s runtime: 59.49s overhead: -265.89s
71
+ (68/99) 73% - killtime: 335.78s runtime: 60.49s overhead: -275.29s
72
+ (71/99) 73% - killtime: 346.07s runtime: 61.50s overhead: -284.57s
73
+ (71/99) 73% - killtime: 346.07s runtime: 62.51s overhead: -283.56s
74
+ (73/99) 73% - killtime: 354.33s runtime: 63.52s overhead: -290.81s
75
+
76
+ -----------------------
77
+ Mutant configuration:
78
+ Matcher: #<Mutant::Matcher::Config match_expressions: [Export::ActivityExporter]>
79
+ Integration: Mutant::Integration::Rspec
80
+ Jobs: 6
81
+ Includes: []
82
+ Requires: ["./config/environment.rb"]
83
+ Subjects: 3
84
+ Mutations: 99
85
+ Results: 99
86
+ Kills: 73
87
+ Alive: 26
88
+ Runtime: 63.52s
89
+ Killtime: 354.33s
90
+ Overhead: -82.07%
91
+ Mutations/s: 1.56
92
+ Coverage: 73.74%
@@ -0,0 +1,92 @@
1
+ Module#name from: XPath::HTML returned name(.). Fix your lib to follow normal ruby semantics!
2
+ {Module,Class}#name should return resolvable constant name as String or nil
3
+ Module#name from: XPath returned name(.). Fix your lib to follow normal ruby semantics!
4
+ {Module,Class}#name should return resolvable constant name as String or nil
5
+ Mutant configuration:
6
+ Matcher: #<Mutant::Matcher::Config match_expressions: [Export::ActivityExporter2]>
7
+ Integration: Mutant::Integration::Rspec
8
+ Jobs: 6
9
+ Includes: []
10
+ Requires: ["./config/environment.rb"]
11
+ (00/99) 100% - killtime: 0.00s runtime: 0.00s overhead: 0.00s
12
+ (00/99) 100% - killtime: 0.00s runtime: 1.01s overhead: 1.01s
13
+ (00/99) 100% - killtime: 0.00s runtime: 2.02s overhead: 2.02s
14
+ (00/99) 100% - killtime: 0.00s runtime: 3.03s overhead: 3.03s
15
+ (06/99) 100% - killtime: 20.02s runtime: 4.04s overhead: -15.98s
16
+ (06/99) 100% - killtime: 20.02s runtime: 5.04s overhead: -14.98s
17
+ (06/99) 100% - killtime: 20.02s runtime: 6.05s overhead: -13.97s
18
+ (07/99) 100% - killtime: 23.37s runtime: 7.05s overhead: -16.32s
19
+ (12/99) 100% - killtime: 40.64s runtime: 8.06s overhead: -32.58s
20
+ (12/99) 100% - killtime: 40.64s runtime: 9.07s overhead: -31.57s
21
+ (12/99) 100% - killtime: 40.64s runtime: 10.08s overhead: -30.56s
22
+ (18/99) 100% - killtime: 61.69s runtime: 11.09s overhead: -50.60s
23
+ (18/99) 100% - killtime: 61.69s runtime: 12.09s overhead: -49.59s
24
+ (18/99) 100% - killtime: 61.69s runtime: 13.10s overhead: -48.59s
25
+ (18/99) 100% - killtime: 61.69s runtime: 14.11s overhead: -47.58s
26
+ (24/99) 100% - killtime: 81.67s runtime: 15.12s overhead: -66.55s
27
+ (24/99) 100% - killtime: 81.67s runtime: 16.13s overhead: -65.54s
28
+ (24/99) 100% - killtime: 81.67s runtime: 17.15s overhead: -64.52s
29
+ (28/99) 100% - killtime: 95.46s runtime: 18.16s overhead: -77.30s
30
+ (28/99) 93% - killtime: 103.04s runtime: 19.16s overhead: -83.88s
31
+ (28/99) 93% - killtime: 103.04s runtime: 20.17s overhead: -82.87s
32
+ (28/99) 93% - killtime: 103.04s runtime: 21.18s overhead: -81.86s
33
+ (30/99) 88% - killtime: 117.44s runtime: 22.19s overhead: -95.25s
34
+ (30/99) 83% - killtime: 125.24s runtime: 23.20s overhead: -102.04s
35
+ (30/99) 83% - killtime: 125.24s runtime: 24.20s overhead: -101.04s
36
+ (31/99) 83% - killtime: 128.75s runtime: 25.21s overhead: -103.54s
37
+ (33/99) 82% - killtime: 139.71s runtime: 26.22s overhead: -113.49s
38
+ (33/99) 78% - killtime: 147.26s runtime: 27.23s overhead: -120.03s
39
+ (33/99) 78% - killtime: 147.26s runtime: 28.24s overhead: -119.03s
40
+ (33/99) 78% - killtime: 147.26s runtime: 29.25s overhead: -118.02s
41
+ (35/99) 77% - killtime: 159.20s runtime: 30.25s overhead: -128.95s
42
+ (38/99) 79% - killtime: 171.71s runtime: 31.27s overhead: -140.44s
43
+ (38/99) 79% - killtime: 171.71s runtime: 32.27s overhead: -139.43s
44
+ (38/99) 79% - killtime: 171.71s runtime: 33.28s overhead: -138.42s
45
+ (41/99) 80% - killtime: 184.03s runtime: 34.29s overhead: -149.74s
46
+ (44/99) 81% - killtime: 195.63s runtime: 35.30s overhead: -160.33s
47
+ (44/99) 81% - killtime: 195.63s runtime: 36.31s overhead: -159.33s
48
+ (44/99) 81% - killtime: 195.63s runtime: 37.31s overhead: -158.32s
49
+ (46/99) 80% - killtime: 206.66s runtime: 38.32s overhead: -168.34s
50
+ (46/99) 76% - killtime: 217.97s runtime: 39.33s overhead: -178.65s
51
+ (46/99) 76% - killtime: 217.97s runtime: 40.33s overhead: -177.64s
52
+ (46/99) 75% - killtime: 221.72s runtime: 41.34s overhead: -180.38s
53
+ (50/99) 76% - killtime: 235.68s runtime: 42.34s overhead: -193.34s
54
+ (51/99) 77% - killtime: 239.21s runtime: 43.35s overhead: -195.85s
55
+ (51/99) 77% - killtime: 239.21s runtime: 44.36s overhead: -194.85s
56
+ (53/99) 77% - killtime: 246.10s runtime: 45.37s overhead: -200.73s
57
+ (53/99) 74% - killtime: 257.73s runtime: 46.39s overhead: -211.35s
58
+ (53/99) 73% - killtime: 261.44s runtime: 47.39s overhead: -214.05s
59
+ (53/99) 73% - killtime: 261.44s runtime: 48.40s overhead: -213.03s
60
+ (55/99) 73% - killtime: 271.98s runtime: 49.41s overhead: -222.57s
61
+ (56/99) 72% - killtime: 279.21s runtime: 50.42s overhead: -228.79s
62
+ (56/99) 71% - killtime: 282.94s runtime: 51.43s overhead: -231.52s
63
+ (56/99) 71% - killtime: 282.94s runtime: 52.43s overhead: -230.52s
64
+ (59/99) 72% - killtime: 293.60s runtime: 53.44s overhead: -240.17s
65
+ (62/99) 73% - killtime: 304.24s runtime: 54.44s overhead: -249.80s
66
+ (62/99) 73% - killtime: 304.24s runtime: 55.45s overhead: -248.79s
67
+ (63/99) 73% - killtime: 311.21s runtime: 56.46s overhead: -254.75s
68
+ (64/99) 72% - killtime: 318.20s runtime: 57.47s overhead: -260.73s
69
+ (65/99) 72% - killtime: 325.37s runtime: 58.48s overhead: -266.89s
70
+ (65/99) 72% - killtime: 325.37s runtime: 59.49s overhead: -265.89s
71
+ (68/99) 73% - killtime: 335.78s runtime: 60.49s overhead: -275.29s
72
+ (71/99) 73% - killtime: 346.07s runtime: 61.50s overhead: -284.57s
73
+ (71/99) 73% - killtime: 346.07s runtime: 62.51s overhead: -283.56s
74
+ (73/99) 73% - killtime: 354.33s runtime: 63.52s overhead: -290.81s
75
+
76
+ -----------------------
77
+ Mutant configuration:
78
+ Matcher: #<Mutant::Matcher::Config match_expressions: [Export::ActivityExporter2]>
79
+ Integration: Mutant::Integration::Rspec
80
+ Jobs: 6
81
+ Includes: []
82
+ Requires: ["./config/environment.rb"]
83
+ Subjects: 3
84
+ Mutations: 99
85
+ Results: 99
86
+ Kills: 73
87
+ Alive: 26
88
+ Runtime: 63.52s
89
+ Killtime: 354.33s
90
+ Overhead: -82.07%
91
+ Mutations/s: 1.56
92
+ Coverage: 73.74%
@@ -0,0 +1,19 @@
1
+
2
+ 2 module(s) were mutated in 2 minutes 7 seconds
3
+ for a total of 198 mutations tested @ 1.56/sec average
4
+ which left 52 mutations alive (26.3%)
5
+ and 146 killed (73.7%)
6
+
7
+ 0 module(s) were fully mutated (0.0%)
8
+
9
+ The following modules had most alive mutations (top 10):
10
+ . Export::ActivityExporter (26)
11
+ . Export::ActivityExporter2 (26)
12
+
13
+ The following modules had longest mutation time (top 10):
14
+ . Export::ActivityExporter (1 minute 3 seconds)
15
+ . Export::ActivityExporter2 (1 minute 3 seconds)
16
+
17
+ The following modules had largest mutation count (top 10):
18
+ . Export::ActivityExporter (99)
19
+ . Export::ActivityExporter2 (99)
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require File.expand_path('../lib/mutator_rails/version', __FILE__)
4
+
5
+ Gem::Specification.new do |gem|
6
+ gem.name = 'mutator_rails'
7
+ gem.version = MutatorRails::VERSION.dup
8
+ gem.authors = %w[Tim\ Chambers Jason\ Dinsmore]
9
+ gem.email = ['tim@possibilogy.com', 'jason@dinjas.com']
10
+ gem.summary = 'Integrate automated mutation testing into Rails.'
11
+ gem.description = 'Automate mutation testing to find weaknesses in code'
12
+ gem.homepage = 'https://github.com/dinj-oss/mutator_rails'
13
+ gem.license = 'MIT'
14
+
15
+ gem.require_paths = ['lib']
16
+ gem.required_rubygems_version = '>= 1.3.6'
17
+ gem.required_ruby_version = '>= 2.3'
18
+
19
+ gem.files = `git ls-files`.split("\n")
20
+ gem.test_files = `git ls-files -- {spec}/*`.split("\n")
21
+
22
+ gem.add_development_dependency 'bundler', '~> 1.15'
23
+ gem.add_development_dependency 'rake', '~> 12.0'
24
+ gem.add_development_dependency 'rails', '>= 4.0'
25
+ gem.add_development_dependency 'rspec-core', '~> 3.6.0'
26
+ gem.add_development_dependency 'rspec-expectations', '~> 3.6.0'
27
+ gem.add_development_dependency 'rspec_junit_formatter'
28
+ gem.add_development_dependency 'codeclimate-test-reporter'
29
+ gem.add_development_dependency 'rspec-collection_matchers'
30
+ gem.add_development_dependency 'rspec-mocks', '~> 3.6.0'
31
+ gem.add_development_dependency 'mutant', '~> 0.8.14'
32
+ gem.add_development_dependency 'mutant-rspec', '~> 0.8.14'
33
+ gem.add_development_dependency 'concord', '~> 0.1.4'
34
+ gem.add_development_dependency 'procto', '~> 0.0.3'
35
+ gem.add_development_dependency 'adamantium', '~> 0.2.0'
36
+ gem.add_development_dependency 'reek', '~> 4.7.2'
37
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ require_relative '../../app/models/test'
6
+
7
+ RSpec.describe Test do
8
+ let(:object) { described_class.new }
9
+
10
+ describe '#call' do
11
+ it 'processes' do
12
+ object.call
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe MutatorRails::Analyze do
6
+ let(:object) { described_class.call }
7
+ let(:analysis_file) { 'log/mutant/analysis.tsv' }
8
+ before do
9
+ File.delete(analysis_file) if File.exist?(analysis_file)
10
+ end
11
+
12
+ describe '#call' do
13
+ it 'processes the log files' do
14
+ object
15
+
16
+ expect(File.exist?(analysis_file)).to be true
17
+ end
18
+
19
+ it 'has the correct number of lines' do
20
+ object
21
+ analysis = File.read(analysis_file)
22
+
23
+ expect(analysis.split("\n")).to have(3).lines
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe MutatorRails::Cleanup do
6
+ let(:object) { described_class.call }
7
+
8
+ describe '#call' do
9
+ it 'processes the all code' do
10
+ object
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe MutatorRails::FullMutate do
6
+ let(:object) { described_class.call }
7
+
8
+ describe '#call' do
9
+ it 'processes the all code' do
10
+ object
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe MutatorRails::Guide do
6
+ let(:object) { described_class.new }
7
+ let(:guide_file) { 'log/mutant/guide.txt' }
8
+ let(:log) { 'log/mutant/models/test.log'}
9
+ let(:code_md5) { Digest::MD5.hexdigest('abc') }
10
+ let(:spec_md5) { Digest::MD5.hexdigest('def') }
11
+ before do
12
+ File.delete(guide_file)
13
+ end
14
+
15
+ describe '#current?' do
16
+ it 'processes the log files' do
17
+ expect(object.current?(log, code_md5, spec_md5)).to be false
18
+
19
+ object.update(log, code_md5, spec_md5)
20
+
21
+ expect(object.current?(log, code_md5, spec_md5)).to be true
22
+ end
23
+ end
24
+
25
+ describe '#update' do
26
+ it 'processes the log files' do
27
+ object.update(log, code_md5, spec_md5)
28
+
29
+ content = File.read(guide_file)
30
+ expect(content).to match("#{log} | #{code_md5} | #{spec_md5} | #{MutatorRails::MUTANT_VERSION}")
31
+ end
32
+ end
33
+ end