mutant 0.8.8 → 0.8.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +9 -0
- data/README.md +1 -1
- data/Rakefile +12 -8
- data/bin/mutant +5 -1
- data/config/flay.yml +1 -1
- data/lib/mutant.rb +18 -17
- data/lib/mutant/actor.rb +1 -7
- data/lib/mutant/actor/env.rb +0 -4
- data/lib/mutant/actor/mailbox.rb +0 -4
- data/lib/mutant/actor/receiver.rb +0 -4
- data/lib/mutant/actor/sender.rb +0 -2
- data/lib/mutant/ast.rb +1 -5
- data/lib/mutant/ast/meta/const.rb +0 -2
- data/lib/mutant/ast/meta/optarg.rb +0 -2
- data/lib/mutant/ast/meta/send.rb +0 -12
- data/lib/mutant/ast/named_children.rb +0 -10
- data/lib/mutant/ast/sexp.rb +1 -5
- data/lib/mutant/cli.rb +19 -38
- data/lib/mutant/color.rb +1 -7
- data/lib/mutant/config.rb +11 -7
- data/lib/mutant/context.rb +0 -4
- data/lib/mutant/context/scope.rb +0 -18
- data/lib/mutant/delegator.rb +0 -6
- data/lib/mutant/diff.rb +0 -18
- data/lib/mutant/env.rb +8 -24
- data/lib/mutant/env/bootstrap.rb +18 -41
- data/lib/mutant/expression.rb +0 -8
- data/lib/mutant/expression/method.rb +6 -7
- data/lib/mutant/expression/methods.rb +5 -9
- data/lib/mutant/expression/namespace.rb +0 -13
- data/lib/mutant/expression/parser.rb +0 -6
- data/lib/mutant/integration.rb +2 -20
- data/lib/mutant/isolation.rb +0 -4
- data/lib/mutant/loader.rb +20 -35
- data/lib/mutant/matcher.rb +1 -1
- data/lib/mutant/matcher/chain.rb +1 -3
- data/lib/mutant/matcher/compiler.rb +0 -8
- data/lib/mutant/matcher/config.rb +2 -10
- data/lib/mutant/matcher/filter.rb +1 -3
- data/lib/mutant/matcher/method.rb +4 -26
- data/lib/mutant/matcher/method/instance.rb +1 -7
- data/lib/mutant/matcher/method/singleton.rb +0 -12
- data/lib/mutant/matcher/methods.rb +1 -19
- data/lib/mutant/matcher/namespace.rb +1 -7
- data/lib/mutant/matcher/null.rb +1 -3
- data/lib/mutant/matcher/scope.rb +1 -5
- data/lib/mutant/matcher/static.rb +0 -2
- data/lib/mutant/meta.rb +0 -2
- data/lib/mutant/meta/example.rb +0 -28
- data/lib/mutant/meta/example/dsl.rb +2 -16
- data/lib/mutant/mutation.rb +9 -18
- data/lib/mutant/mutator.rb +0 -24
- data/lib/mutant/mutator/node.rb +1 -33
- data/lib/mutant/mutator/node/and_asgn.rb +0 -2
- data/lib/mutant/mutator/node/argument.rb +0 -10
- data/lib/mutant/mutator/node/arguments.rb +0 -12
- data/lib/mutant/mutator/node/begin.rb +0 -4
- data/lib/mutant/mutator/node/binary.rb +2 -11
- data/lib/mutant/mutator/node/block.rb +0 -6
- data/lib/mutant/mutator/node/break.rb +0 -2
- data/lib/mutant/mutator/node/case.rb +0 -6
- data/lib/mutant/mutator/node/conditional_loop.rb +0 -2
- data/lib/mutant/mutator/node/const.rb +1 -3
- data/lib/mutant/mutator/node/define.rb +4 -11
- data/lib/mutant/mutator/node/defined.rb +0 -2
- data/lib/mutant/mutator/node/dstr.rb +0 -2
- data/lib/mutant/mutator/node/dsym.rb +0 -2
- data/lib/mutant/mutator/node/generic.rb +1 -3
- data/lib/mutant/mutator/node/if.rb +0 -8
- data/lib/mutant/mutator/node/kwbegin.rb +0 -2
- data/lib/mutant/mutator/node/literal/array.rb +0 -4
- data/lib/mutant/mutator/node/literal/boolean.rb +0 -2
- data/lib/mutant/mutator/node/literal/fixnum.rb +0 -6
- data/lib/mutant/mutator/node/literal/float.rb +0 -6
- data/lib/mutant/mutator/node/literal/hash.rb +0 -6
- data/lib/mutant/mutator/node/literal/nil.rb +0 -2
- data/lib/mutant/mutator/node/literal/range.rb +0 -8
- data/lib/mutant/mutator/node/literal/regex.rb +0 -4
- data/lib/mutant/mutator/node/literal/string.rb +0 -2
- data/lib/mutant/mutator/node/literal/symbol.rb +0 -2
- data/lib/mutant/mutator/node/masgn.rb +0 -2
- data/lib/mutant/mutator/node/match_current_line.rb +0 -2
- data/lib/mutant/mutator/node/mlhs.rb +0 -2
- data/lib/mutant/mutator/node/named_value/access.rb +0 -8
- data/lib/mutant/mutator/node/named_value/constant_assignment.rb +1 -7
- data/lib/mutant/mutator/node/named_value/variable_assignment.rb +0 -4
- data/lib/mutant/mutator/node/next.rb +0 -2
- data/lib/mutant/mutator/node/noop.rb +0 -2
- data/lib/mutant/mutator/node/nthref.rb +0 -2
- data/lib/mutant/mutator/node/op_asgn.rb +0 -2
- data/lib/mutant/mutator/node/or_asgn.rb +0 -2
- data/lib/mutant/mutator/node/resbody.rb +0 -4
- data/lib/mutant/mutator/node/rescue.rb +0 -10
- data/lib/mutant/mutator/node/return.rb +0 -2
- data/lib/mutant/mutator/node/send.rb +4 -32
- data/lib/mutant/mutator/node/send/attribute_assignment.rb +0 -6
- data/lib/mutant/mutator/node/send/binary.rb +0 -6
- data/lib/mutant/mutator/node/send/index.rb +0 -6
- data/lib/mutant/mutator/node/splat.rb +0 -2
- data/lib/mutant/mutator/node/super.rb +0 -2
- data/lib/mutant/mutator/node/when.rb +0 -10
- data/lib/mutant/mutator/node/yield.rb +0 -2
- data/lib/mutant/mutator/node/zsuper.rb +0 -2
- data/lib/mutant/mutator/registry.rb +0 -6
- data/lib/mutant/mutator/util.rb +0 -4
- data/lib/mutant/mutator/util/array.rb +0 -6
- data/lib/mutant/mutator/util/symbol.rb +0 -2
- data/lib/mutant/parallel.rb +21 -17
- data/lib/mutant/parallel/master.rb +0 -28
- data/lib/mutant/parallel/source.rb +0 -10
- data/lib/mutant/parallel/worker.rb +15 -10
- data/lib/mutant/parser.rb +23 -0
- data/lib/mutant/reporter.rb +5 -8
- data/lib/mutant/reporter/cli.rb +1 -15
- data/lib/mutant/reporter/cli/format.rb +3 -25
- data/lib/mutant/reporter/cli/printer.rb +0 -18
- data/lib/mutant/reporter/cli/printer/config.rb +0 -2
- data/lib/mutant/reporter/cli/printer/env_progress.rb +0 -2
- data/lib/mutant/reporter/cli/printer/env_result.rb +0 -2
- data/lib/mutant/reporter/cli/printer/mutation_progress_result.rb +0 -4
- data/lib/mutant/reporter/cli/printer/mutation_result.rb +0 -16
- data/lib/mutant/reporter/cli/printer/status.rb +0 -6
- data/lib/mutant/reporter/cli/printer/status_progressive.rb +0 -4
- data/lib/mutant/reporter/cli/printer/subject_progress.rb +0 -8
- data/lib/mutant/reporter/cli/printer/subject_result.rb +0 -2
- data/lib/mutant/reporter/cli/printer/test_result.rb +0 -2
- data/lib/mutant/reporter/cli/tput.rb +0 -4
- data/lib/mutant/repository.rb +4 -22
- data/lib/mutant/require_highjack.rb +0 -2
- data/lib/mutant/result.rb +23 -43
- data/lib/mutant/runner.rb +7 -20
- data/lib/mutant/runner/sink.rb +43 -86
- data/lib/mutant/selector.rb +0 -2
- data/lib/mutant/selector/expression.rb +0 -2
- data/lib/mutant/subject.rb +0 -22
- data/lib/mutant/subject/method.rb +2 -10
- data/lib/mutant/subject/method/instance.rb +0 -6
- data/lib/mutant/subject/method/singleton.rb +0 -2
- data/lib/mutant/test.rb +4 -3
- data/lib/mutant/version.rb +1 -1
- data/lib/mutant/warning_filter.rb +0 -10
- data/lib/mutant/zombifier.rb +5 -20
- data/meta/or_asgn.rb +6 -0
- data/meta/send.rb +29 -0
- data/mutant-rspec.gemspec +1 -1
- data/spec/integration/mutant/rspec_spec.rb +1 -1
- data/spec/integrations.yml +2 -3
- data/spec/shared/method_matcher_behavior.rb +7 -7
- data/spec/spec_helper.rb +2 -9
- data/spec/support/corpus.rb +37 -30
- data/spec/support/rb_bug.rb +1 -2
- data/spec/support/ruby_vm.rb +6 -3
- data/spec/support/shared_context.rb +19 -20
- data/spec/unit/mutant/actor/binding_spec.rb +6 -6
- data/spec/unit/mutant/actor/env_spec.rb +2 -2
- data/spec/unit/mutant/actor/mailbox_spec.rb +6 -6
- data/spec/unit/mutant/actor/message_spec.rb +2 -2
- data/spec/unit/mutant/actor/receiver_spec.rb +4 -4
- data/spec/unit/mutant/actor/sender_spec.rb +6 -6
- data/spec/unit/mutant/ast_spec.rb +9 -0
- data/spec/unit/mutant/cli_spec.rb +16 -10
- data/spec/unit/mutant/context/scope/root_spec.rb +1 -1
- data/spec/unit/mutant/context/scope/unqualified_name_spec.rb +1 -1
- data/spec/unit/mutant/context/scope_spec.rb +3 -3
- data/spec/unit/mutant/context_spec.rb +0 -22
- data/spec/unit/mutant/env/boostrap_spec.rb +34 -41
- data/spec/unit/mutant/env_spec.rb +74 -32
- data/spec/unit/mutant/integration/rspec_spec.rb +23 -17
- data/spec/unit/mutant/integration_spec.rb +4 -4
- data/spec/unit/mutant/isolation_spec.rb +4 -4
- data/spec/unit/mutant/loader_spec.rb +42 -0
- data/spec/unit/mutant/matcher/compiler_spec.rb +3 -3
- data/spec/unit/mutant/matcher/config_spec.rb +1 -1
- data/spec/unit/mutant/matcher/method/instance_spec.rb +8 -1
- data/spec/unit/mutant/matcher/method/singleton_spec.rb +8 -1
- data/spec/unit/mutant/matcher/namespace_spec.rb +7 -8
- data/spec/unit/mutant/matcher/null_spec.rb +3 -2
- data/spec/unit/mutant/mutation_spec.rb +11 -5
- data/spec/unit/mutant/mutator/registry_spec.rb +1 -1
- data/spec/unit/mutant/parallel/master_spec.rb +9 -9
- data/spec/unit/mutant/parallel/source/array_spec.rb +3 -3
- data/spec/unit/mutant/parallel/worker_spec.rb +5 -5
- data/spec/unit/mutant/parallel_spec.rb +4 -4
- data/spec/unit/mutant/parser_spec.rb +24 -0
- data/spec/unit/mutant/reporter/cli/printer_spec.rb +3 -3
- data/spec/unit/mutant/reporter/cli/tput_spec.rb +2 -2
- data/spec/unit/mutant/reporter/cli_spec.rb +7 -7
- data/spec/unit/mutant/reporter/null_spec.rb +5 -4
- data/spec/unit/mutant/repository/diff_spec.rb +30 -18
- data/spec/unit/mutant/repository/subject_filter_spec.rb +5 -5
- data/spec/unit/mutant/require_highjack_spec.rb +1 -1
- data/spec/unit/mutant/result/env_spec.rb +9 -9
- data/spec/unit/mutant/result/subject_spec.rb +5 -5
- data/spec/unit/mutant/runner/driver_spec.rb +4 -4
- data/spec/unit/mutant/runner/{sink/mutation_spec.rb → sink_spec.rb} +16 -4
- data/spec/unit/mutant/runner_spec.rb +31 -31
- data/spec/unit/mutant/selector/expression_spec.rb +8 -8
- data/spec/unit/mutant/subject/method/instance_spec.rb +9 -3
- data/spec/unit/mutant/subject/method/singleton_spec.rb +1 -1
- data/spec/unit/mutant/subject_spec.rb +1 -5
- data/spec/unit/mutant_spec.rb +3 -3
- metadata +9 -15
- data/config/mutant.yml +0 -14
- data/lib/mutant/cache.rb +0 -29
- data/lib/mutant/reporter/trace.rb +0 -36
- data/spec/support/rspec.rb +0 -21
- data/spec/unit/mutant/cache_spec.rb +0 -22
- data/spec/unit/mutant/loader/eval_spec.rb +0 -44
- data/spec/unit/mutant/reporter/trace_spec.rb +0 -21
- data/test_app/Gemfile.rspec3.2 +0 -7
@@ -3,8 +3,8 @@ require 'mutant/integration/rspec'
|
|
3
3
|
RSpec.describe Mutant::Integration::Rspec do
|
4
4
|
let(:object) { described_class.new(Mutant::Config::DEFAULT) }
|
5
5
|
|
6
|
-
let(:
|
7
|
-
let(:
|
6
|
+
let(:rspec_options) { instance_double(RSpec::Core::ConfigurationOptions) }
|
7
|
+
let(:rspec_runner) { instance_double(RSpec::Core::Runner) }
|
8
8
|
|
9
9
|
let(:example_a) do
|
10
10
|
double(
|
@@ -115,10 +115,16 @@ RSpec.describe Mutant::Integration::Rspec do
|
|
115
115
|
end
|
116
116
|
|
117
117
|
before do
|
118
|
-
expect(RSpec::Core::ConfigurationOptions).to receive(:new)
|
119
|
-
|
120
|
-
|
121
|
-
|
118
|
+
expect(RSpec::Core::ConfigurationOptions).to receive(:new)
|
119
|
+
.with(%w[spec --fail-fast])
|
120
|
+
.and_return(rspec_options)
|
121
|
+
|
122
|
+
expect(RSpec::Core::Runner).to receive(:new)
|
123
|
+
.with(rspec_options)
|
124
|
+
.and_return(rspec_runner)
|
125
|
+
|
126
|
+
expect(RSpec).to receive_messages(world: world)
|
127
|
+
allow(Time).to receive_messages(now: Time.now)
|
122
128
|
end
|
123
129
|
|
124
130
|
describe '#all_tests' do
|
@@ -131,7 +137,7 @@ RSpec.describe Mutant::Integration::Rspec do
|
|
131
137
|
subject { object.setup }
|
132
138
|
|
133
139
|
before do
|
134
|
-
expect(
|
140
|
+
expect(rspec_runner).to receive(:setup) do |error, output|
|
135
141
|
expect(error).to be($stderr)
|
136
142
|
output.write('foo')
|
137
143
|
end
|
@@ -144,7 +150,7 @@ RSpec.describe Mutant::Integration::Rspec do
|
|
144
150
|
subject { object.call(tests) }
|
145
151
|
|
146
152
|
before do
|
147
|
-
expect(
|
153
|
+
expect(rspec_runner).to receive(:setup) do |_errors, output|
|
148
154
|
output.write('the-test-output')
|
149
155
|
end
|
150
156
|
|
@@ -157,7 +163,7 @@ RSpec.describe Mutant::Integration::Rspec do
|
|
157
163
|
expect(world).to receive(:ordered_example_groups) do
|
158
164
|
filtered_examples.values.flatten
|
159
165
|
end
|
160
|
-
expect(
|
166
|
+
expect(rspec_runner).to receive(:run_specs).with([example_a]).and_return(exit_status)
|
161
167
|
end
|
162
168
|
|
163
169
|
context 'on unsuccessful exit' do
|
@@ -166,10 +172,10 @@ RSpec.describe Mutant::Integration::Rspec do
|
|
166
172
|
it 'should return failed result' do
|
167
173
|
expect(subject).to eql(
|
168
174
|
Mutant::Result::Test.new(
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
175
|
+
output: 'the-test-output',
|
176
|
+
passed: false,
|
177
|
+
runtime: 0.0,
|
178
|
+
tests: tests
|
173
179
|
)
|
174
180
|
)
|
175
181
|
end
|
@@ -181,10 +187,10 @@ RSpec.describe Mutant::Integration::Rspec do
|
|
181
187
|
it 'should return passed result' do
|
182
188
|
expect(subject).to eql(
|
183
189
|
Mutant::Result::Test.new(
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
190
|
+
output: 'the-test-output',
|
191
|
+
passed: true,
|
192
|
+
runtime: 0.0,
|
193
|
+
tests: tests
|
188
194
|
)
|
189
195
|
)
|
190
196
|
end
|
@@ -25,17 +25,17 @@ RSpec.describe Mutant::Integration::Null do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
describe '#call' do
|
28
|
-
let(:tests) {
|
28
|
+
let(:tests) { instance_double(Array) }
|
29
29
|
|
30
30
|
subject { object.call(tests) }
|
31
31
|
|
32
32
|
it 'returns test result' do
|
33
33
|
should eql(
|
34
34
|
Mutant::Result::Test.new(
|
35
|
-
|
36
|
-
runtime: 0.0,
|
35
|
+
output: '',
|
37
36
|
passed: true,
|
38
|
-
|
37
|
+
runtime: 0.0,
|
38
|
+
tests: tests
|
39
39
|
)
|
40
40
|
)
|
41
41
|
end
|
@@ -65,8 +65,8 @@ RSpec.describe Mutant::Isolation::Fork do
|
|
65
65
|
end
|
66
66
|
|
67
67
|
context 'uses primitives in correct order' do
|
68
|
-
let(:reader) {
|
69
|
-
let(:writer) {
|
68
|
+
let(:reader) { instance_double(IO) }
|
69
|
+
let(:writer) { instance_double(IO) }
|
70
70
|
|
71
71
|
before do
|
72
72
|
expect(IO).to receive(:pipe).with(binmode: true).ordered do |&block|
|
@@ -76,9 +76,9 @@ RSpec.describe Mutant::Isolation::Fork do
|
|
76
76
|
end
|
77
77
|
|
78
78
|
it 'when fork succeeds' do
|
79
|
-
pid =
|
79
|
+
pid = instance_double(Fixnum)
|
80
80
|
expect(Process).to receive(:fork).ordered.and_yield.and_return(pid)
|
81
|
-
file =
|
81
|
+
file = instance_double(File)
|
82
82
|
expect(File).to receive(:open).ordered
|
83
83
|
.with(File::NULL, File::WRONLY).and_yield(file)
|
84
84
|
expect($stderr).to receive(:reopen).ordered.with(file)
|
@@ -0,0 +1,42 @@
|
|
1
|
+
RSpec.describe Mutant::Loader, '.call' do
|
2
|
+
subject do
|
3
|
+
described_class.call(
|
4
|
+
binding: binding,
|
5
|
+
kernel: kernel,
|
6
|
+
node: node,
|
7
|
+
subject: mutation_subject
|
8
|
+
)
|
9
|
+
end
|
10
|
+
|
11
|
+
let(:path) { instance_double(Pathname, to_s: path_str) }
|
12
|
+
let(:path_str) { instance_double(String) }
|
13
|
+
let(:line) { instance_double(Fixnum) }
|
14
|
+
let(:kernel) { instance_double(Kernel.singleton_class) }
|
15
|
+
let(:binding) { instance_double(Binding) }
|
16
|
+
let(:source) { instance_double(String) }
|
17
|
+
let(:node) { instance_double(Parser::AST::Node) }
|
18
|
+
|
19
|
+
let(:mutation_subject) do
|
20
|
+
instance_double(
|
21
|
+
Mutant::Subject,
|
22
|
+
source_path: path,
|
23
|
+
source_line: line
|
24
|
+
)
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'performs expected kernel interaction' do
|
28
|
+
expect(Unparser).to receive(:unparse)
|
29
|
+
.with(node)
|
30
|
+
.and_return(source)
|
31
|
+
|
32
|
+
expect(kernel).to receive(:eval)
|
33
|
+
.with(
|
34
|
+
source,
|
35
|
+
binding,
|
36
|
+
path_str,
|
37
|
+
line
|
38
|
+
)
|
39
|
+
|
40
|
+
subject
|
41
|
+
end
|
42
|
+
end
|
@@ -62,14 +62,14 @@ RSpec.describe Mutant::Matcher::Compiler, '#call' do
|
|
62
62
|
end
|
63
63
|
|
64
64
|
context 'and subject filters' do
|
65
|
-
let(:
|
65
|
+
let(:subject_filter) { instance_double(Mutant::Matcher) }
|
66
66
|
|
67
67
|
let(:attributes) do
|
68
|
-
super().merge(subject_filters: [
|
68
|
+
super().merge(subject_filters: [subject_filter])
|
69
69
|
end
|
70
70
|
|
71
71
|
let(:subject_filter_predicates) do
|
72
|
-
[
|
72
|
+
[subject_filter]
|
73
73
|
end
|
74
74
|
|
75
75
|
it { should eql(expected_matcher) }
|
@@ -30,7 +30,7 @@ RSpec.describe Mutant::Matcher::Config do
|
|
30
30
|
.add(:ignore_expressions, parse_expression('Bar'))
|
31
31
|
end
|
32
32
|
|
33
|
-
it { should eql('#<Mutant::Matcher::Config
|
33
|
+
it { should eql('#<Mutant::Matcher::Config ignore_expressions: [Bar] match_expressions: [Foo]>') }
|
34
34
|
end
|
35
35
|
|
36
36
|
context 'with subject filter' do
|
@@ -2,7 +2,6 @@ RSpec.describe Mutant::Matcher::Method::Instance, '#call' do
|
|
2
2
|
subject { object.call(env) }
|
3
3
|
|
4
4
|
let(:object) { described_class.new(scope, method) }
|
5
|
-
let(:env) { test_env }
|
6
5
|
let(:method_name) { :foo }
|
7
6
|
let(:source_path) { MutantSpec::ROOT.join('test_app/lib/test_app.rb') }
|
8
7
|
let(:method) { scope.instance_method(method_name) }
|
@@ -11,6 +10,14 @@ RSpec.describe Mutant::Matcher::Method::Instance, '#call' do
|
|
11
10
|
let(:method_arity) { 0 }
|
12
11
|
let(:base) { TestApp::InstanceMethodTests }
|
13
12
|
|
13
|
+
let(:env) do
|
14
|
+
instance_double(
|
15
|
+
Mutant::Env::Bootstrap,
|
16
|
+
config: Mutant::Config::DEFAULT,
|
17
|
+
parser: Fixtures::TEST_ENV.parser
|
18
|
+
)
|
19
|
+
end
|
20
|
+
|
14
21
|
def name
|
15
22
|
node.children.fetch(0)
|
16
23
|
end
|
@@ -2,7 +2,6 @@ RSpec.describe Mutant::Matcher::Method::Singleton, '#call' do
|
|
2
2
|
subject { object.call(env) }
|
3
3
|
|
4
4
|
let(:object) { described_class.new(scope, method) }
|
5
|
-
let(:env) { test_env }
|
6
5
|
let(:method) { scope.method(method_name) }
|
7
6
|
let(:type) { :defs }
|
8
7
|
let(:method_name) { :foo }
|
@@ -10,6 +9,14 @@ RSpec.describe Mutant::Matcher::Method::Singleton, '#call' do
|
|
10
9
|
let(:base) { TestApp::SingletonMethodTests }
|
11
10
|
let(:source_path) { MutantSpec::ROOT.join('test_app/lib/test_app.rb') }
|
12
11
|
|
12
|
+
let(:env) do
|
13
|
+
instance_double(
|
14
|
+
Mutant::Env::Bootstrap,
|
15
|
+
config: Mutant::Config::DEFAULT,
|
16
|
+
parser: Fixtures::TEST_ENV.parser
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
13
20
|
def name
|
14
21
|
node.children.fetch(1)
|
15
22
|
end
|
@@ -1,12 +1,11 @@
|
|
1
1
|
RSpec.describe Mutant::Matcher::Namespace, '#call' do
|
2
|
-
let(:object)
|
3
|
-
let(:env)
|
4
|
-
let(:raw_scope_a) {
|
5
|
-
|
6
|
-
let(:
|
7
|
-
let(:
|
8
|
-
let(:
|
9
|
-
let(:subject_b) { double('SubjectB') }
|
2
|
+
let(:object) { described_class.new(parse_expression('TestApp*')) }
|
3
|
+
let(:env) { instance_double(Mutant::Env) }
|
4
|
+
let(:raw_scope_a) { instance_double(Class, name: 'TestApp::Literal') }
|
5
|
+
let(:raw_scope_b) { instance_double(Class, name: 'TestApp::Foo') }
|
6
|
+
let(:raw_scope_c) { instance_double(Class, name: 'TestAppOther') }
|
7
|
+
let(:subject_a) { instance_double(Mutant::Subject) }
|
8
|
+
let(:subject_b) { instance_double(Mutant::Subject) }
|
10
9
|
|
11
10
|
before do
|
12
11
|
[
|
@@ -1,6 +1,7 @@
|
|
1
1
|
RSpec.describe Mutant::Matcher::Null, '#call' do
|
2
|
-
let(:object) { described_class.new
|
3
|
-
let(:env)
|
2
|
+
let(:object) { described_class.new }
|
3
|
+
let(:env) { instance_double(Mutant::Env) }
|
4
|
+
|
4
5
|
subject { object.call(env) }
|
5
6
|
|
6
7
|
it 'returns no subjects' do
|
@@ -19,9 +19,10 @@ RSpec.describe Mutant::Mutation do
|
|
19
19
|
let(:test_b) { instance_double(Mutant::Test) }
|
20
20
|
|
21
21
|
describe '#insert' do
|
22
|
-
subject { object.insert }
|
22
|
+
subject { object.insert(kernel) }
|
23
23
|
|
24
|
-
let(:root_node) { s(:foo)
|
24
|
+
let(:root_node) { s(:foo) }
|
25
|
+
let(:kernel) { instance_double(Kernel) }
|
25
26
|
|
26
27
|
before do
|
27
28
|
expect(context).to receive(:root)
|
@@ -32,10 +33,15 @@ RSpec.describe Mutant::Mutation do
|
|
32
33
|
.ordered
|
33
34
|
.and_return(mutation_subject)
|
34
35
|
|
35
|
-
expect(Mutant::Loader
|
36
|
+
expect(Mutant::Loader).to receive(:call)
|
36
37
|
.ordered
|
37
|
-
.with(
|
38
|
-
|
38
|
+
.with(
|
39
|
+
binding: TOPLEVEL_BINDING,
|
40
|
+
kernel: kernel,
|
41
|
+
node: root_node,
|
42
|
+
subject: mutation_subject
|
43
|
+
)
|
44
|
+
.and_return(Mutant::Loader)
|
39
45
|
end
|
40
46
|
|
41
47
|
it_should_behave_like 'a command method'
|
@@ -1,16 +1,16 @@
|
|
1
1
|
RSpec.describe Mutant::Parallel::Master do
|
2
2
|
let(:message_sequence) { FakeActor::MessageSequence.new }
|
3
3
|
let(:actor_names) { %i[master worker_a worker_b] }
|
4
|
-
let(:status) {
|
4
|
+
let(:status) { instance_double(Mutant::Result::Status) }
|
5
5
|
let(:sink) { FakeSink.new }
|
6
|
-
let(:processor) {
|
6
|
+
let(:processor) { instance_double(Proc) }
|
7
7
|
let(:worker_a) { actor_env.mailbox(:worker_a).sender }
|
8
8
|
let(:worker_b) { actor_env.mailbox(:worker_b).sender }
|
9
9
|
let(:parent) { actor_env.mailbox(:parent).sender }
|
10
|
-
let(:job_payload_a) {
|
11
|
-
let(:job_payload_b) {
|
12
|
-
let(:job_result_payload_a) {
|
13
|
-
let(:job_result_payload_b) {
|
10
|
+
let(:job_payload_a) { instance_double(Object) }
|
11
|
+
let(:job_payload_b) { instance_double(Object) }
|
12
|
+
let(:job_result_payload_a) { instance_double(Object) }
|
13
|
+
let(:job_result_payload_b) { instance_double(Object) }
|
14
14
|
let(:job_a) { Mutant::Parallel::Job.new(index: 0, payload: job_payload_a) }
|
15
15
|
let(:job_b) { Mutant::Parallel::Job.new(index: 1, payload: job_payload_b) }
|
16
16
|
let(:job_result_a) { Mutant::Parallel::JobResult.new(job: job_a, payload: job_result_payload_a) }
|
@@ -36,11 +36,11 @@ RSpec.describe Mutant::Parallel::Master do
|
|
36
36
|
|
37
37
|
let(:config) do
|
38
38
|
Mutant::Parallel::Config.new(
|
39
|
-
jobs: 1,
|
40
39
|
env: actor_env,
|
41
|
-
|
40
|
+
jobs: 1,
|
41
|
+
processor: processor,
|
42
42
|
sink: sink,
|
43
|
-
|
43
|
+
source: Mutant::Parallel::Source::Array.new([job_payload_a, job_payload_b])
|
44
44
|
)
|
45
45
|
end
|
46
46
|
|
@@ -1,9 +1,9 @@
|
|
1
1
|
RSpec.describe Mutant::Parallel::Source::Array do
|
2
2
|
let(:object) { described_class.new(jobs) }
|
3
3
|
|
4
|
-
let(:job_a) {
|
5
|
-
let(:job_b) {
|
6
|
-
let(:job_c) {
|
4
|
+
let(:job_a) { instance_double(Mutant::Parallel::Job) }
|
5
|
+
let(:job_b) { instance_double(Mutant::Parallel::Job) }
|
6
|
+
let(:job_c) { instance_double(Mutant::Parallel::Job) }
|
7
7
|
|
8
8
|
let(:jobs) { [job_a, job_b, job_c] }
|
9
9
|
|
@@ -4,11 +4,11 @@ RSpec.describe Mutant::Parallel::Worker do
|
|
4
4
|
end
|
5
5
|
|
6
6
|
let(:message_sequence) { FakeActor::MessageSequence.new }
|
7
|
-
let(:processor) {
|
7
|
+
let(:processor) { instance_double(Proc) }
|
8
8
|
let(:mailbox) { actor_env.mailbox(:worker) }
|
9
9
|
let(:parent) { actor_env.mailbox(:parent).sender }
|
10
|
-
let(:payload) {
|
11
|
-
let(:result_payload) {
|
10
|
+
let(:payload) { instance_double(Object) }
|
11
|
+
let(:result_payload) { instance_double(Object) }
|
12
12
|
|
13
13
|
let(:attributes) do
|
14
14
|
{
|
@@ -38,8 +38,8 @@ RSpec.describe Mutant::Parallel::Worker do
|
|
38
38
|
message_sequence.add(:worker, :stop)
|
39
39
|
end
|
40
40
|
|
41
|
-
let(:index) {
|
42
|
-
let(:test_result) {
|
41
|
+
let(:index) { instance_double(Fixnum) }
|
42
|
+
let(:test_result) { instance_double(Mutant::Result::Test) }
|
43
43
|
let(:job_result) { Mutant::Parallel::JobResult.new(job: job, payload: result_payload) }
|
44
44
|
let(:job) { Mutant::Parallel::Job.new(index: index, payload: payload) }
|
45
45
|
|
@@ -2,10 +2,10 @@ RSpec.describe Mutant::Parallel do
|
|
2
2
|
describe '.async' do
|
3
3
|
subject { described_class.async(config) }
|
4
4
|
|
5
|
-
let(:config) {
|
6
|
-
let(:env) {
|
7
|
-
let(:mailbox) { Mutant::Actor::Mailbox.new
|
8
|
-
let(:master) {
|
5
|
+
let(:config) { instance_double(Mutant::Parallel::Config, env: env) }
|
6
|
+
let(:env) { instance_double(Mutant::Actor::Env, new_mailbox: mailbox) }
|
7
|
+
let(:mailbox) { Mutant::Actor::Mailbox.new }
|
8
|
+
let(:master) { instance_double(Mutant::Parallel::Master) }
|
9
9
|
|
10
10
|
before do
|
11
11
|
expect(described_class::Master).to receive(:call).with(config).and_return(master)
|
@@ -0,0 +1,24 @@
|
|
1
|
+
RSpec.describe Mutant::Parser do
|
2
|
+
let(:object) { described_class.new }
|
3
|
+
|
4
|
+
describe '#call' do
|
5
|
+
let(:path) { instance_double(Pathname) }
|
6
|
+
|
7
|
+
subject { object.call(path) }
|
8
|
+
|
9
|
+
before do
|
10
|
+
expect(path).to receive(:read)
|
11
|
+
.with(no_args)
|
12
|
+
.and_return(':source')
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'returns parsed source' do
|
16
|
+
expect(subject).to eql(s(:sym, :source))
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'is idempotent' do
|
20
|
+
source = object.call(path)
|
21
|
+
expect(subject).to be(source)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -12,9 +12,9 @@ RSpec.describe Mutant::Reporter::CLI::Printer do
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
let(:reportable) {
|
16
|
-
let(:tty?) { true
|
17
|
-
let(:success?) { true
|
15
|
+
let(:reportable) { instance_double(Mutant::Result::Env, success?: success?) }
|
16
|
+
let(:tty?) { true }
|
17
|
+
let(:success?) { true }
|
18
18
|
|
19
19
|
context '.call' do
|
20
20
|
let(:class_under_test) do
|