mutant 0.3.0.beta21 → 0.3.0.beta22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +37 -6
- data/.rspec +2 -0
- data/.ruby-gemset +1 -0
- data/.travis.yml +13 -7
- data/Gemfile +8 -3
- data/Gemfile.devtools +2 -6
- data/Guardfile +22 -8
- data/README.md +3 -1
- data/Rakefile +3 -0
- data/bin/mutant +4 -3
- data/config/devtools.yml +1 -1
- data/config/flay.yml +1 -1
- data/config/flog.yml +1 -1
- data/config/reek.yml +7 -6
- data/config/rubocop.yml +55 -0
- data/lib/mutant.rb +3 -1
- data/lib/mutant/cache.rb +2 -0
- data/lib/mutant/cli.rb +14 -10
- data/lib/mutant/cli/classifier.rb +22 -10
- data/lib/mutant/cli/classifier/method.rb +14 -15
- data/lib/mutant/cli/classifier/namespace.rb +6 -2
- data/lib/mutant/cli/classifier/scope.rb +3 -1
- data/lib/mutant/color.rb +7 -3
- data/lib/mutant/config.rb +2 -0
- data/lib/mutant/constants.rb +5 -4
- data/lib/mutant/context.rb +2 -0
- data/lib/mutant/context/scope.rb +3 -1
- data/lib/mutant/differ.rb +10 -2
- data/lib/mutant/killer.rb +4 -1
- data/lib/mutant/killer/forked.rb +2 -0
- data/lib/mutant/killer/forking.rb +2 -0
- data/lib/mutant/killer/rspec.rb +19 -3
- data/lib/mutant/killer/static.rb +2 -0
- data/lib/mutant/loader.rb +8 -1
- data/lib/mutant/matcher.rb +2 -0
- data/lib/mutant/matcher/chain.rb +2 -0
- data/lib/mutant/matcher/method.rb +15 -3
- data/lib/mutant/matcher/method/finder.rb +2 -0
- data/lib/mutant/matcher/method/instance.rb +4 -1
- data/lib/mutant/matcher/method/singleton.rb +7 -1
- data/lib/mutant/matcher/methods.rb +3 -1
- data/lib/mutant/matcher/namespace.rb +4 -2
- data/lib/mutant/matcher/scope.rb +2 -0
- data/lib/mutant/mutation.rb +19 -5
- data/lib/mutant/mutation/evil.rb +12 -0
- data/lib/mutant/mutation/filter.rb +2 -0
- data/lib/mutant/mutation/filter/code.rb +3 -1
- data/lib/mutant/mutation/filter/regexp.rb +2 -0
- data/lib/mutant/mutation/filter/whitelist.rb +2 -0
- data/lib/mutant/mutation/neutral.rb +25 -0
- data/lib/mutant/mutator.rb +4 -6
- data/lib/mutant/mutator/node.rb +5 -1
- data/lib/mutant/mutator/node/argument.rb +2 -0
- data/lib/mutant/mutator/node/arguments.rb +2 -0
- data/lib/mutant/mutator/node/begin.rb +2 -0
- data/lib/mutant/mutator/node/block.rb +2 -0
- data/lib/mutant/mutator/node/case.rb +3 -1
- data/lib/mutant/mutator/node/connective/binary.rb +3 -1
- data/lib/mutant/mutator/node/const.rb +2 -0
- data/lib/mutant/mutator/node/define.rb +2 -0
- data/lib/mutant/mutator/node/generic.rb +4 -3
- data/lib/mutant/mutator/node/if.rb +2 -0
- data/lib/mutant/mutator/node/literal.rb +2 -0
- data/lib/mutant/mutator/node/literal/array.rb +2 -0
- data/lib/mutant/mutator/node/literal/boolean.rb +2 -0
- data/lib/mutant/mutator/node/literal/dynamic.rb +2 -0
- data/lib/mutant/mutator/node/literal/fixnum.rb +3 -1
- data/lib/mutant/mutator/node/literal/float.rb +2 -0
- data/lib/mutant/mutator/node/literal/hash.rb +2 -0
- data/lib/mutant/mutator/node/literal/nil.rb +2 -0
- data/lib/mutant/mutator/node/literal/range.rb +2 -1
- data/lib/mutant/mutator/node/literal/regex.rb +2 -0
- data/lib/mutant/mutator/node/literal/string.rb +2 -0
- data/lib/mutant/mutator/node/literal/symbol.rb +5 -1
- data/lib/mutant/mutator/node/masgn.rb +2 -0
- data/lib/mutant/mutator/node/mlhs.rb +2 -0
- data/lib/mutant/mutator/node/named_value/access.rb +2 -0
- data/lib/mutant/mutator/node/named_value/constant_assignment.rb +2 -0
- data/lib/mutant/mutator/node/named_value/variable_assignment.rb +3 -1
- data/lib/mutant/mutator/node/{cbase.rb → noop.rb} +7 -5
- data/lib/mutant/mutator/node/return.rb +2 -0
- data/lib/mutant/mutator/node/send.rb +2 -0
- data/lib/mutant/mutator/node/send/binary.rb +2 -0
- data/lib/mutant/mutator/node/splat.rb +2 -0
- data/lib/mutant/mutator/node/super.rb +2 -0
- data/lib/mutant/mutator/node/when.rb +3 -1
- data/lib/mutant/mutator/node/while.rb +2 -0
- data/lib/mutant/mutator/node/zsuper.rb +2 -0
- data/lib/mutant/mutator/registry.rb +55 -13
- data/lib/mutant/mutator/util.rb +2 -0
- data/lib/mutant/mutator/util/array.rb +3 -1
- data/lib/mutant/mutator/util/symbol.rb +2 -0
- data/lib/mutant/node_helpers.rb +10 -4
- data/lib/mutant/random.rb +2 -0
- data/lib/mutant/reporter.rb +2 -0
- data/lib/mutant/reporter/cli.rb +2 -0
- data/lib/mutant/reporter/cli/printer.rb +2 -0
- data/lib/mutant/reporter/cli/printer/config.rb +5 -2
- data/lib/mutant/reporter/cli/printer/killer.rb +2 -0
- data/lib/mutant/reporter/cli/printer/mutation.rb +13 -6
- data/lib/mutant/reporter/cli/printer/subject.rb +5 -1
- data/lib/mutant/reporter/null.rb +2 -0
- data/lib/mutant/runner.rb +2 -0
- data/lib/mutant/runner/config.rb +2 -0
- data/lib/mutant/runner/mutation.rb +2 -0
- data/lib/mutant/runner/subject.rb +2 -0
- data/lib/mutant/singleton_methods.rb +5 -3
- data/lib/mutant/strategy.rb +2 -0
- data/lib/mutant/strategy/method_expansion.rb +2 -0
- data/lib/mutant/strategy/rspec.rb +2 -0
- data/lib/mutant/strategy/rspec/dm2.rb +2 -0
- data/lib/mutant/strategy/rspec/dm2/lookup.rb +4 -2
- data/lib/mutant/strategy/rspec/dm2/lookup/method.rb +2 -0
- data/lib/mutant/strategy/static.rb +2 -0
- data/lib/mutant/subject.rb +4 -1
- data/lib/mutant/subject/method.rb +2 -0
- data/lib/mutant/subject/method/instance.rb +2 -0
- data/lib/mutant/subject/method/singleton.rb +2 -0
- data/lib/mutant/support/method_object.rb +2 -0
- data/lib/mutant/zombifier.rb +10 -6
- data/mutant.gemspec +11 -10
- data/spec/integration/mutant/rspec_killer_spec.rb +9 -4
- data/spec/integration/mutant/test_mutator_handles_types_spec.rb +3 -1
- data/spec/integration/mutant/zombie_spec.rb +2 -0
- data/spec/shared/method_matcher_behavior.rb +2 -0
- data/spec/shared/mutator_behavior.rb +16 -7
- data/spec/spec_helper.rb +26 -5
- data/spec/support/compress_helper.rb +5 -5
- data/spec/support/ice_nine_config.rb +2 -0
- data/spec/support/rspec.rb +2 -0
- data/spec/support/test_app.rb +2 -0
- data/spec/unit/mutant/class_methods/singleton_subclass_instance_spec.rb +2 -0
- data/spec/unit/mutant/cli/class_methods/new_spec.rb +17 -8
- data/spec/unit/mutant/cli/class_methods/run_spec.rb +10 -2
- data/spec/unit/mutant/cli/classifier/class_methods/build_spec.rb +4 -1
- data/spec/unit/mutant/cli/classifier/method/each_spec.rb +89 -0
- data/spec/unit/mutant/cli/classifier/namespace/flat/each_spec.rb +58 -0
- data/spec/unit/mutant/cli/classifier/namespace/recursive/each_spec.rb +58 -0
- data/spec/unit/mutant/cli/classifier/scope/each_spec.rb +33 -0
- data/spec/unit/mutant/context/root_spec.rb +5 -1
- data/spec/unit/mutant/context/scope/root_spec.rb +2 -0
- data/spec/unit/mutant/context/scope/unqualified_name_spec.rb +2 -0
- data/spec/unit/mutant/differ/class_methods/build_spec.rb +2 -0
- data/spec/unit/mutant/differ/class_methods/colorize_line_spec.rb +2 -0
- data/spec/unit/mutant/differ/diff_spec.rb +67 -5
- data/spec/unit/mutant/killer/rspec/class_methods/new_spec.rb +21 -4
- data/spec/unit/mutant/killer/success_predicate_spec.rb +2 -0
- data/spec/unit/mutant/loader/eval/class_methods/run_spec.rb +12 -5
- data/spec/unit/mutant/matcher/chain/each_spec.rb +2 -0
- data/spec/unit/mutant/matcher/chain/matchers_spec.rb +2 -0
- data/spec/unit/mutant/matcher/each_spec.rb +8 -1
- data/spec/unit/mutant/matcher/method/instance/class_methods/build_spec.rb +4 -2
- data/spec/unit/mutant/matcher/method/instance/each_spec.rb +21 -20
- data/spec/unit/mutant/matcher/method/singleton/each_spec.rb +22 -19
- data/spec/unit/mutant/matcher/methods/instance/each_spec.rb +8 -3
- data/spec/unit/mutant/matcher/methods/singleton/each_spec.rb +8 -3
- data/spec/unit/mutant/matcher/namespace/each_spec.rb +8 -2
- data/spec/unit/mutant/mutator/each_spec.rb +2 -0
- data/spec/unit/mutant/mutator/emit_new_spec.rb +10 -3
- data/spec/unit/mutant/mutator/emit_spec.rb +4 -2
- data/spec/unit/mutant/mutator/node/and_asgn/mutation_spec.rb +26 -0
- data/spec/unit/mutant/mutator/node/begin/mutation_spec.rb +2 -0
- data/spec/unit/mutant/mutator/node/block/mutation_spec.rb +4 -2
- data/spec/unit/mutant/mutator/node/block_pass/mutation_spec.rb +14 -0
- data/spec/unit/mutant/mutator/node/break/mutation_spec.rb +15 -0
- data/spec/unit/mutant/mutator/node/case/mutation_spec.rb +2 -0
- data/spec/unit/mutant/mutator/node/cbase/mutation_spec.rb +3 -6
- data/spec/unit/mutant/mutator/node/connective/binary/mutation_spec.rb +2 -0
- data/spec/unit/mutant/mutator/node/const/mutation_spec.rb +3 -6
- data/spec/unit/mutant/mutator/node/define/mutation_spec.rb +2 -1
- data/spec/unit/mutant/mutator/node/defined_predicate/mutation_spec.rb +10 -0
- data/spec/unit/mutant/mutator/node/dstr/mutation_spec.rb +21 -0
- data/spec/unit/mutant/mutator/node/dsym/mutation_spec.rb +21 -0
- data/spec/unit/mutant/mutator/node/ensure/mutation_spec.rb +15 -0
- data/spec/unit/mutant/mutator/node/if/mutation_spec.rb +2 -1
- data/spec/unit/mutant/mutator/node/literal/array_spec.rb +2 -0
- data/spec/unit/mutant/mutator/node/literal/boolean/mutation_spec.rb +2 -0
- data/spec/unit/mutant/mutator/node/literal/fixnum_spec.rb +2 -0
- data/spec/unit/mutant/mutator/node/literal/float_spec.rb +4 -2
- data/spec/unit/mutant/mutator/node/literal/hash_spec.rb +2 -0
- data/spec/unit/mutant/mutator/node/literal/nil_spec.rb +4 -5
- data/spec/unit/mutant/mutator/node/literal/range_spec.rb +8 -8
- data/spec/unit/mutant/mutator/node/literal/regex_spec.rb +2 -0
- data/spec/unit/mutant/mutator/node/literal/string_spec.rb +2 -0
- data/spec/unit/mutant/mutator/node/literal/symbol_spec.rb +2 -0
- data/spec/unit/mutant/mutator/node/masgn/mutation_spec.rb +4 -10
- data/spec/unit/mutant/mutator/node/match_current_line/mutation_spec.rb +20 -0
- data/spec/unit/mutant/mutator/node/named_value/access/mutation_spec.rb +3 -2
- data/spec/unit/mutant/mutator/node/named_value/constant_assignment/mutation_spec.rb +3 -2
- data/spec/unit/mutant/mutator/node/named_value/variable_assignment/mutation_spec.rb +3 -2
- data/spec/unit/mutant/mutator/node/next/mutation_spec.rb +15 -0
- data/spec/unit/mutant/mutator/node/op_assgn/mutation_spec.rb +26 -0
- data/spec/unit/mutant/mutator/node/or_asgn/mutation_spec.rb +26 -0
- data/spec/unit/mutant/mutator/node/redo/mutation_spec.rb +10 -0
- data/spec/unit/mutant/mutator/node/rescue/mutation_spec.rb +24 -0
- data/spec/unit/mutant/mutator/node/restarg/mutation_spec.rb +16 -0
- data/spec/unit/mutant/mutator/node/return/mutation_spec.rb +2 -0
- data/spec/unit/mutant/mutator/node/send/mutation_spec.rb +3 -1
- data/spec/unit/mutant/mutator/node/super/mutation_spec.rb +2 -0
- data/spec/unit/mutant/mutator/node/while/mutation_spec.rb +3 -1
- data/spec/unit/mutant/mutator/node/yield/mutation_spec.rb +15 -0
- data/spec/unit/mutant/node_helpers/n_not_spec.rb +2 -0
- data/spec/unit/mutant/runner/config/subjects_spec.rb +6 -2
- data/spec/unit/mutant/runner/config/success_predicate_spec.rb +15 -6
- data/spec/unit/mutant/runner/mutation/killer_spec.rb +3 -1
- data/spec/unit/mutant/runner/subject/success_predicate_spec.rb +15 -8
- data/spec/unit/mutant/strategy/method_expansion/class_methods/run_spec.rb +2 -0
- data/spec/unit/mutant/strategy/rspec/dm2/lookup/method/instance/spec_files_spec.rb +32 -11
- data/spec/unit/mutant/strategy/rspec/dm2/lookup/method/singleton/spec_files_spec.rb +31 -11
- data/spec/unit/mutant/subject/context_spec.rb +2 -0
- data/spec/unit/mutant/subject/mutations_spec.rb +2 -0
- data/spec/unit/mutant/subject/node_spec.rb +2 -0
- data/test_app/lib/test_app.rb +2 -0
- data/test_app/lib/test_app/literal.rb +2 -0
- data/test_app/spec/shared/method_filter_parse_behavior.rb +5 -1
- data/test_app/spec/shared/method_match_behavior.rb +2 -0
- data/test_app/spec/spec_helper.rb +3 -1
- data/test_app/spec/unit/test_app/literal/command_spec.rb +2 -0
- data/test_app/spec/unit/test_app/literal/string_spec.rb +3 -1
- metadata +66 -18
- data/bin/zombie +0 -18
- data/test_app/spec/shared/mutator_behavior.rb +0 -44
@@ -0,0 +1,26 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Mutant::Mutator::Node::Generic, 'or_asgn' do
|
6
|
+
let(:random_fixnum) { 5 }
|
7
|
+
let(:random_string) { 'random' }
|
8
|
+
|
9
|
+
let(:source) { 'a ||= 1' }
|
10
|
+
|
11
|
+
let(:mutations) do
|
12
|
+
mutations = []
|
13
|
+
mutations << 'srandom ||= 1'
|
14
|
+
mutations << 'a ||= nil'
|
15
|
+
mutations << 'a ||= 0'
|
16
|
+
mutations << 'a ||= -1'
|
17
|
+
mutations << 'a ||= 2'
|
18
|
+
mutations << 'a ||= 5'
|
19
|
+
end
|
20
|
+
|
21
|
+
before do
|
22
|
+
Mutant::Random.stub(:fixnum => random_fixnum, :hex_string => random_string)
|
23
|
+
end
|
24
|
+
|
25
|
+
it_should_behave_like 'a mutator'
|
26
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Mutant::Mutator::Node::Generic, 'rescue' do
|
6
|
+
let(:source) { 'begin; rescue Exception => e; true end' }
|
7
|
+
|
8
|
+
let(:mutations) do
|
9
|
+
mutations = []
|
10
|
+
mutations << 'begin; rescue Exception => srandom; true; end'
|
11
|
+
mutations << 'begin; rescue Exception => e; false; end'
|
12
|
+
mutations << 'begin; rescue Exception => e; nil; end'
|
13
|
+
mutations << 'begin; rescue nil => e; true; end'
|
14
|
+
# mutations << 'begin; rescue => e; true; end' # FIXME
|
15
|
+
end
|
16
|
+
|
17
|
+
before do
|
18
|
+
Mutant::Random.stub(:hex_string => 'random')
|
19
|
+
end
|
20
|
+
|
21
|
+
pending do
|
22
|
+
it_should_behave_like 'a mutator'
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Mutant::Mutator::Node::Generic, 'restarg' do
|
6
|
+
let(:source) { 'foo(*bar)' }
|
7
|
+
|
8
|
+
let(:mutations) do
|
9
|
+
mutants = []
|
10
|
+
mutants << 'foo'
|
11
|
+
mutants << 'foo(nil)'
|
12
|
+
mutants << 'foo(bar)'
|
13
|
+
end
|
14
|
+
|
15
|
+
it_should_behave_like 'a mutator'
|
16
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
# FIXME: This spec needs to be structured better!
|
@@ -190,7 +192,7 @@ describe Mutant::Mutator, 'send' do
|
|
190
192
|
let(:mutations) do
|
191
193
|
mutations = []
|
192
194
|
mutations << 'foo'
|
193
|
-
mutations << 'left - right'
|
195
|
+
mutations << '(left - right)'
|
194
196
|
mutations << 'left / foo'
|
195
197
|
mutations << 'right / foo'
|
196
198
|
end
|
@@ -1,9 +1,11 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe Mutant::Mutator::Node::While do
|
4
6
|
|
5
7
|
context 'with more than one statement' do
|
6
|
-
let(:source) {
|
8
|
+
let(:source) { 'while true; foo; bar; end' }
|
7
9
|
|
8
10
|
let(:mutations) do
|
9
11
|
mutations = []
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Mutant::Mutator::Node::Generic, 'yield' do
|
6
|
+
let(:source) { 'yield true' }
|
7
|
+
|
8
|
+
let(:mutations) do
|
9
|
+
mutations = []
|
10
|
+
mutations << 'yield false'
|
11
|
+
mutations << 'yield nil'
|
12
|
+
end
|
13
|
+
|
14
|
+
it_should_behave_like 'a mutator'
|
15
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe Mutant::Runner::Config, '#subjects' do
|
@@ -33,16 +35,18 @@ describe Mutant::Runner::Config, '#subjects' do
|
|
33
35
|
context 'without earily stop' do
|
34
36
|
let(:stop_a) { false }
|
35
37
|
let(:stop_b) { false }
|
38
|
+
|
36
39
|
it { should eql([runner_a, runner_b]) }
|
40
|
+
|
37
41
|
it_should_behave_like 'an idempotent method'
|
38
42
|
end
|
39
43
|
|
40
|
-
|
41
44
|
context 'with earily stop' do
|
42
45
|
let(:stop_a) { true }
|
43
46
|
let(:stop_b) { false }
|
47
|
+
|
44
48
|
it { should eql([runner_a]) }
|
49
|
+
|
45
50
|
it_should_behave_like 'an idempotent method'
|
46
51
|
end
|
47
|
-
|
48
52
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe Mutant::Runner::Config, '#success?' do
|
@@ -14,12 +16,18 @@ describe Mutant::Runner::Config, '#success?' do
|
|
14
16
|
)
|
15
17
|
end
|
16
18
|
|
17
|
-
let(:reporter) { double('Reporter')
|
18
|
-
let(:strategy) { double('Strategy')
|
19
|
-
let(:subject_a) { double('Subject A')
|
20
|
-
let(:subject_b) { double('Subject B')
|
21
|
-
|
22
|
-
let(:
|
19
|
+
let(:reporter) { double('Reporter') }
|
20
|
+
let(:strategy) { double('Strategy') }
|
21
|
+
let(:subject_a) { double('Subject A') }
|
22
|
+
let(:subject_b) { double('Subject B') }
|
23
|
+
|
24
|
+
let(:runner_a) do
|
25
|
+
double('Runner A', :stop? => stop_a, :success? => success_a)
|
26
|
+
end
|
27
|
+
|
28
|
+
let(:runner_b) do
|
29
|
+
double('Runner B', :stop? => stop_b, :success? => success_b)
|
30
|
+
end
|
23
31
|
|
24
32
|
before do
|
25
33
|
reporter.stub(:report => reporter)
|
@@ -34,6 +42,7 @@ describe Mutant::Runner::Config, '#success?' do
|
|
34
42
|
let(:stop_b) { false }
|
35
43
|
let(:success_a) { true }
|
36
44
|
let(:success_b) { true }
|
45
|
+
|
37
46
|
it { should be(true) }
|
38
47
|
end
|
39
48
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe Mutant::Runner::Mutation, '#killer' do
|
@@ -27,7 +29,7 @@ describe Mutant::Runner::Mutation, '#killer' do
|
|
27
29
|
end
|
28
30
|
|
29
31
|
it 'should call configuration to identify strategy' do
|
30
|
-
config.should_receive(:strategy).with().and_return(strategy)
|
32
|
+
config.should_receive(:strategy).with(no_args).and_return(strategy)
|
31
33
|
should be(killer)
|
32
34
|
end
|
33
35
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe Mutant::Runner::Subject, '#success?' do
|
@@ -5,21 +7,26 @@ describe Mutant::Runner::Subject, '#success?' do
|
|
5
7
|
|
6
8
|
let(:object) { described_class.new(config, mutation_subject) }
|
7
9
|
|
8
|
-
let(:mutation_subject)
|
10
|
+
let(:mutation_subject) do
|
9
11
|
double(
|
10
12
|
'Subject',
|
11
13
|
:class => Mutant::Subject,
|
12
14
|
:mutations => [mutation_a, mutation_b]
|
13
15
|
)
|
14
|
-
|
16
|
+
end
|
15
17
|
|
16
|
-
let(:reporter)
|
17
|
-
let(:config)
|
18
|
-
let(:mutation_a)
|
19
|
-
let(:mutation_b)
|
18
|
+
let(:reporter) { double('Reporter') }
|
19
|
+
let(:config) { double('Config', :reporter => reporter) }
|
20
|
+
let(:mutation_a) { double('Mutation A') }
|
21
|
+
let(:mutation_b) { double('Mutation B') }
|
20
22
|
|
21
|
-
let(:runner_a)
|
22
|
-
|
23
|
+
let(:runner_a) do
|
24
|
+
double('Runner A', :success? => success_a, :stop? => stop_a)
|
25
|
+
end
|
26
|
+
|
27
|
+
let(:runner_b) do
|
28
|
+
double('Runner B', :success? => success_b, :stop? => stop_b)
|
29
|
+
end
|
23
30
|
|
24
31
|
before do
|
25
32
|
reporter.stub(:report => reporter)
|
@@ -1,24 +1,42 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
|
-
|
5
|
+
singleton = Mutant::Strategy::Rspec::DM2::Lookup::Method::Instance
|
6
|
+
|
7
|
+
describe singleton, '#spec_files' do
|
4
8
|
subject { object.spec_files }
|
5
9
|
|
6
|
-
let(:object) { described_class.new(mutation_subject)
|
7
|
-
let(:
|
8
|
-
let(:
|
9
|
-
let(:
|
10
|
-
|
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
|
11
23
|
|
12
|
-
this_example_group =
|
24
|
+
this_example_group = description
|
13
25
|
|
14
26
|
shared_examples_for this_example_group do
|
15
27
|
it_should_behave_like 'an idempotent method'
|
16
28
|
|
17
29
|
before do
|
18
30
|
if is_public
|
19
|
-
Mutant::Strategy::MethodExpansion
|
31
|
+
Mutant::Strategy::MethodExpansion
|
32
|
+
.should_receive(:run)
|
33
|
+
.with(method_name)
|
34
|
+
.and_return(:expanded_name)
|
20
35
|
end
|
21
|
-
|
36
|
+
|
37
|
+
Dir.should_receive(:glob)
|
38
|
+
.with(expected_glob_expression)
|
39
|
+
.and_return(files)
|
22
40
|
end
|
23
41
|
|
24
42
|
it { should be(files) }
|
@@ -42,8 +60,11 @@ describe Mutant::Strategy::Rspec::DM2::Lookup::Method::Instance, '#spec_files' d
|
|
42
60
|
end
|
43
61
|
|
44
62
|
context 'initialize' do
|
45
|
-
let(:method_name) { :initialize
|
46
|
-
|
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
|
47
68
|
|
48
69
|
it_should_behave_like this_example_group
|
49
70
|
end
|
@@ -1,25 +1,42 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
|
-
|
5
|
+
singleton = Mutant::Strategy::Rspec::DM2::Lookup::Method::Singleton
|
6
|
+
|
7
|
+
describe singleton, '#spec_files' do
|
4
8
|
|
5
9
|
subject { object.spec_files }
|
6
10
|
|
7
|
-
let(:object) { described_class.new(mutation_subject)
|
8
|
-
let(:
|
9
|
-
let(:
|
10
|
-
let(:
|
11
|
-
|
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
|
12
24
|
|
13
|
-
this_example_group =
|
25
|
+
this_example_group = description
|
14
26
|
|
15
27
|
shared_examples_for this_example_group do
|
16
28
|
it_should_behave_like 'an idempotent method'
|
17
29
|
|
18
30
|
before do
|
19
31
|
if is_public
|
20
|
-
Mutant::Strategy::MethodExpansion
|
32
|
+
Mutant::Strategy::MethodExpansion
|
33
|
+
.should_receive(:run)
|
34
|
+
.with(method_name)
|
35
|
+
.and_return(:expanded_name)
|
21
36
|
end
|
22
|
-
Dir.should_receive(:glob)
|
37
|
+
Dir.should_receive(:glob)
|
38
|
+
.with(expected_glob_expression)
|
39
|
+
.and_return(files)
|
23
40
|
end
|
24
41
|
|
25
42
|
it { should be(files) }
|
@@ -27,8 +44,11 @@ describe Mutant::Strategy::Rspec::DM2::Lookup::Method::Singleton, '#spec_files'
|
|
27
44
|
end
|
28
45
|
|
29
46
|
context 'with public method' do
|
30
|
-
let(:is_public) { true
|
31
|
-
|
47
|
+
let(:is_public) { true }
|
48
|
+
|
49
|
+
let(:expected_glob_expression) do
|
50
|
+
'spec/unit/foo/class_methods/expanded_name_spec.rb'
|
51
|
+
end
|
32
52
|
|
33
53
|
it_should_behave_like this_example_group
|
34
54
|
end
|
data/test_app/lib/test_app.rb
CHANGED