mutant 0.3.0.beta22 → 0.3.0.rc1

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 (41) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +4 -5
  3. data/Gemfile.devtools +1 -1
  4. data/README.md +22 -50
  5. data/config/flay.yml +1 -1
  6. data/config/flog.yml +1 -1
  7. data/config/reek.yml +9 -2
  8. data/lib/mutant.rb +3 -4
  9. data/lib/mutant/cli.rb +41 -35
  10. data/lib/mutant/cli/classifier.rb +1 -1
  11. data/lib/mutant/config.rb +2 -1
  12. data/lib/mutant/context/scope.rb +14 -1
  13. data/lib/mutant/killer.rb +10 -0
  14. data/lib/mutant/killer/rspec.rb +52 -18
  15. data/lib/mutant/matcher/method.rb +4 -4
  16. data/lib/mutant/mutator/node/generic.rb +1 -1
  17. data/lib/mutant/mutator/node/literal/float.rb +2 -0
  18. data/lib/mutant/mutator/node/nthref.rb +29 -0
  19. data/lib/mutant/mutator/node/send.rb +17 -0
  20. data/lib/mutant/reporter/cli/printer/killer.rb +9 -3
  21. data/lib/mutant/strategy.rb +9 -9
  22. data/lib/mutant/strategy/rspec.rb +51 -41
  23. data/lib/mutant/subject.rb +16 -6
  24. data/lib/mutant/subject/method.rb +10 -10
  25. data/lib/mutant/version.rb +7 -0
  26. data/lib/mutant/zombifier.rb +2 -3
  27. data/mutant.gemspec +6 -4
  28. data/spec/integration/mutant/rspec_spec.rb +26 -0
  29. data/spec/unit/mutant/cli/class_methods/new_spec.rb +33 -8
  30. data/spec/unit/mutant/killer/rspec/class_methods/new_spec.rb +4 -0
  31. data/spec/unit/mutant/mutator/node/nthref/mutation_spec.rb +19 -0
  32. data/spec/unit/mutant/mutator/node/send/mutation_spec.rb +29 -0
  33. metadata +14 -20
  34. data/lib/mutant/strategy/method_expansion.rb +0 -53
  35. data/lib/mutant/strategy/rspec/dm2.rb +0 -24
  36. data/lib/mutant/strategy/rspec/dm2/lookup.rb +0 -63
  37. data/lib/mutant/strategy/rspec/dm2/lookup/method.rb +0 -145
  38. data/spec/integration/mutant/rspec_killer_spec.rb +0 -29
  39. data/spec/unit/mutant/strategy/method_expansion/class_methods/run_spec.rb +0 -51
  40. data/spec/unit/mutant/strategy/rspec/dm2/lookup/method/instance/spec_files_spec.rb +0 -73
  41. data/spec/unit/mutant/strategy/rspec/dm2/lookup/method/singleton/spec_files_spec.rb +0 -62
@@ -1,29 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'spec_helper'
4
-
5
- describe Mutant, 'rspec integration' do
6
-
7
- around do |example|
8
- Dir.chdir(TestApp.root) do
9
- example.run
10
- end
11
- end
12
-
13
- let(:strategy) { Mutant::Strategy::Rspec::DM2 }
14
-
15
- specify 'allows to kill mutations' do
16
- cli = 'bundle exec mutant --rspec-dm2 ::TestApp::Literal#string'
17
- Kernel.system(cli).should be(true)
18
- end
19
-
20
- specify 'fails to kill mutations when they are not covered' do
21
- cli = 'bundle exec mutant --rspec-dm2 ::TestApp::Literal#uncovered_string'
22
- Kernel.system(cli).should be(false)
23
- end
24
-
25
- specify 'fails when some mutations when are not covered' do
26
- cli = 'bundle exec mutant --rspec-dm2 ::TestApp::Literal'
27
- Kernel.system(cli).should be(false)
28
- end
29
- end
@@ -1,51 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'spec_helper'
4
-
5
- describe Mutant::Strategy::MethodExpansion, '.run' do
6
- subject { object.run(name) }
7
-
8
- let(:object) { described_class }
9
-
10
- context 'unexpandable and unmapped name' do
11
- let(:name) { :foo }
12
-
13
- it { should be(:foo) }
14
- end
15
-
16
- context 'expanded name' do
17
-
18
- context 'predicate' do
19
- let(:name) { :foo? }
20
-
21
- it { should be(:foo_predicate) }
22
- end
23
-
24
- context 'writer' do
25
- let(:name) { :foo= }
26
-
27
- it { should be(:foo_writer) }
28
- end
29
-
30
- context 'bang' do
31
- let(:name) { :foo! }
32
-
33
- it { should be(:foo_bang) }
34
- end
35
-
36
- end
37
-
38
- context 'operator expansions' do
39
-
40
- Mutant::OPERATOR_EXPANSIONS.each do |name, expansion|
41
- context "#{name}" do
42
- let(:name) { name }
43
-
44
- it "should expand to #{expansion}" do
45
- should be(expansion)
46
- end
47
- end
48
- end
49
-
50
- end
51
- end
@@ -1,73 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'spec_helper'
4
-
5
- singleton = Mutant::Strategy::Rspec::DM2::Lookup::Method::Instance
6
-
7
- describe singleton, '#spec_files' do
8
- subject { object.spec_files }
9
-
10
- let(:object) { described_class.new(mutation_subject) }
11
- let(:context) { double('Context', :name => 'Foo') }
12
- let(:method_name) { :bar }
13
- let(:files) { 'Files'.freeze }
14
-
15
- let(:mutation_subject) do
16
- double(
17
- 'Subject',
18
- :name => method_name,
19
- :public? => is_public,
20
- :context => context
21
- )
22
- end
23
-
24
- this_example_group = description
25
-
26
- shared_examples_for this_example_group do
27
- it_should_behave_like 'an idempotent method'
28
-
29
- before do
30
- if is_public
31
- Mutant::Strategy::MethodExpansion
32
- .should_receive(:run)
33
- .with(method_name)
34
- .and_return(:expanded_name)
35
- end
36
-
37
- Dir.should_receive(:glob)
38
- .with(expected_glob_expression)
39
- .and_return(files)
40
- end
41
-
42
- it { should be(files) }
43
- it { should be_frozen }
44
- end
45
-
46
- context 'with public method' do
47
- let(:is_public) { true }
48
- let(:expected_glob_expression) { 'spec/unit/foo/expanded_name_spec.rb' }
49
-
50
- it_should_behave_like this_example_group
51
- end
52
-
53
- context 'with nonpublic method' do
54
- let(:is_public) { false }
55
-
56
- context 'non initialize' do
57
- let(:expected_glob_expression) { 'spec/unit/foo/*_spec.rb' }
58
-
59
- it_should_behave_like this_example_group
60
- end
61
-
62
- context 'initialize' do
63
- let(:method_name) { :initialize }
64
-
65
- let(:expected_glob_expression) do
66
- '{spec/unit/foo/*_spec.rb,spec/unit/foo/class_methods/new_spec.rb}'
67
- end
68
-
69
- it_should_behave_like this_example_group
70
- end
71
-
72
- end
73
- end
@@ -1,62 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'spec_helper'
4
-
5
- singleton = Mutant::Strategy::Rspec::DM2::Lookup::Method::Singleton
6
-
7
- describe singleton, '#spec_files' do
8
-
9
- subject { object.spec_files }
10
-
11
- let(:object) { described_class.new(mutation_subject) }
12
- let(:method_name) { :bar }
13
- let(:files) { 'Files'.freeze }
14
- let(:context) { double('Context', :name => 'Foo') }
15
-
16
- let(:mutation_subject) do
17
- double(
18
- 'Subject',
19
- :name => method_name,
20
- :public? => is_public,
21
- :context => context
22
- )
23
- end
24
-
25
- this_example_group = description
26
-
27
- shared_examples_for this_example_group do
28
- it_should_behave_like 'an idempotent method'
29
-
30
- before do
31
- if is_public
32
- Mutant::Strategy::MethodExpansion
33
- .should_receive(:run)
34
- .with(method_name)
35
- .and_return(:expanded_name)
36
- end
37
- Dir.should_receive(:glob)
38
- .with(expected_glob_expression)
39
- .and_return(files)
40
- end
41
-
42
- it { should be(files) }
43
- it { should be_frozen }
44
- end
45
-
46
- context 'with public method' do
47
- let(:is_public) { true }
48
-
49
- let(:expected_glob_expression) do
50
- 'spec/unit/foo/class_methods/expanded_name_spec.rb'
51
- end
52
-
53
- it_should_behave_like this_example_group
54
- end
55
-
56
- context 'with nonpublic method' do
57
- let(:is_public) { false }
58
- let(:expected_glob_expression) { 'spec/unit/foo/class_methods/*_spec.rb' }
59
-
60
- it_should_behave_like this_example_group
61
- end
62
- end