mutant 0.3.6 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/Changelog.md +13 -0
- data/Gemfile +1 -1
- data/Guardfile +7 -25
- data/LICENSE +1 -1
- data/README.md +16 -10
- data/config/flay.yml +1 -1
- data/config/reek.yml +11 -11
- data/config/rubocop.yml +1 -1
- data/lib/mutant.rb +3 -10
- data/lib/mutant/cli.rb +199 -80
- data/lib/mutant/config.rb +3 -3
- data/lib/mutant/killer.rb +20 -0
- data/lib/mutant/matcher/filter.rb +3 -8
- data/lib/mutant/matcher/method/instance.rb +1 -1
- data/lib/mutant/matcher/namespace.rb +31 -2
- data/lib/mutant/matcher/null.rb +26 -0
- data/lib/mutant/mutation.rb +0 -1
- data/lib/mutant/reporter/cli/printer.rb +29 -0
- data/lib/mutant/reporter/cli/printer/config.rb +16 -116
- data/lib/mutant/runner/config.rb +47 -1
- data/lib/mutant/strategy.rb +39 -1
- data/lib/mutant/version.rb +1 -1
- data/lib/mutant/walker.rb +51 -0
- data/mutant-rspec.gemspec +24 -0
- data/mutant.gemspec +7 -3
- data/spec/integration/mutant/rspec_spec.rb +11 -6
- data/spec/integration/mutant/zombie_spec.rb +2 -2
- data/spec/shared/method_matcher_behavior.rb +6 -6
- data/spec/spec_helper.rb +2 -2
- data/spec/unit/mutant/cli_new_spec.rb +49 -34
- data/spec/unit/mutant/context/scope/root_spec.rb +1 -1
- data/spec/unit/mutant/loader/eval_spec.rb +2 -2
- data/spec/unit/mutant/matcher/chain_spec.rb +1 -1
- data/spec/unit/mutant/matcher/methods/instance_spec.rb +1 -1
- data/spec/unit/mutant/matcher/methods/singleton_spec.rb +1 -1
- data/spec/unit/mutant/matcher/namespace_spec.rb +1 -1
- data/spec/unit/mutant/mutation_spec.rb +1 -1
- data/spec/unit/mutant/{killer/rspec_spec.rb → rspec/killer_spec.rb} +2 -1
- data/spec/unit/mutant/runner/config_spec.rb +36 -21
- data/spec/unit/mutant_spec.rb +7 -9
- metadata +25 -22
- data/lib/mutant/cli/builder.rb +0 -167
- data/lib/mutant/killer/rspec.rb +0 -95
- data/lib/mutant/predicate.rb +0 -70
- data/lib/mutant/predicate/attribute.rb +0 -68
- data/lib/mutant/predicate/blacklist.rb +0 -27
- data/lib/mutant/predicate/matcher.rb +0 -38
- data/lib/mutant/predicate/whitelist.rb +0 -28
- data/lib/mutant/strategy/rspec.rb +0 -76
- data/spec/unit/mutant/cli/builder/rspec_spec.rb +0 -38
- data/spec/unit/mutant/matcher/filter_spec.rb +0 -19
- data/spec/unit/mutant/predicate_spec.rb +0 -135
@@ -1,19 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Mutant::Matcher::Filter do
|
6
|
-
let(:object) { described_class.new(matcher, predicate) }
|
7
|
-
let(:matcher) { [:foo, :bar] }
|
8
|
-
|
9
|
-
let(:predicate) { Mutant::Predicate::Attribute::Equality.new(:to_s, 'foo') }
|
10
|
-
|
11
|
-
describe '#each' do
|
12
|
-
subject { object.each { |item| yields << item } }
|
13
|
-
|
14
|
-
let(:yields) { [] }
|
15
|
-
its(:to_a) { should eql([:bar]) }
|
16
|
-
|
17
|
-
it_should_behave_like 'an #each method'
|
18
|
-
end
|
19
|
-
end
|
@@ -1,135 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
filter_helpers = proc do
|
6
|
-
let(:input_a) { double('Input A', foo: 'bar') }
|
7
|
-
let(:input_b) { double('Input B', foo: 'baz') }
|
8
|
-
|
9
|
-
let(:filter_a) do
|
10
|
-
input_a = self.input_a
|
11
|
-
Module.new do
|
12
|
-
define_singleton_method(:match?) do |input|
|
13
|
-
input == input_a
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
subject { object.match?(input) }
|
19
|
-
end
|
20
|
-
|
21
|
-
describe Mutant::Predicate::Whitelist do
|
22
|
-
instance_eval(&filter_helpers)
|
23
|
-
|
24
|
-
let(:object) { described_class.new(whitelist) }
|
25
|
-
|
26
|
-
describe '#match?' do
|
27
|
-
|
28
|
-
context 'with empty whitelist' do
|
29
|
-
let(:whitelist) { [] }
|
30
|
-
|
31
|
-
it 'accepts all inputs' do
|
32
|
-
expect(object.match?(input_a)).to be(false)
|
33
|
-
expect(object.match?(input_b)).to be(false)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
context 'with non empty whitelist' do
|
38
|
-
let(:whitelist) { [filter_a] }
|
39
|
-
|
40
|
-
context 'with whitelisted input' do
|
41
|
-
let(:input) { input_a }
|
42
|
-
|
43
|
-
it { should be(true) }
|
44
|
-
end
|
45
|
-
|
46
|
-
context 'with non whitelisted input' do
|
47
|
-
let(:input) { input_b }
|
48
|
-
|
49
|
-
it { should be(false) }
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
describe Mutant::Predicate::Blacklist do
|
56
|
-
instance_eval(&filter_helpers)
|
57
|
-
|
58
|
-
let(:object) { described_class.new(whitelist) }
|
59
|
-
|
60
|
-
describe '#match?' do
|
61
|
-
|
62
|
-
context 'with empty whitelist' do
|
63
|
-
let(:whitelist) { [] }
|
64
|
-
|
65
|
-
it 'accepts all inputs' do
|
66
|
-
expect(object.match?(input_a)).to be(true)
|
67
|
-
expect(object.match?(input_b)).to be(true)
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
context 'with non empty whitelist' do
|
72
|
-
let(:whitelist) { [filter_a] }
|
73
|
-
|
74
|
-
context 'with whitelisted input' do
|
75
|
-
let(:input) { input_a }
|
76
|
-
|
77
|
-
it { should be(false) }
|
78
|
-
end
|
79
|
-
|
80
|
-
context 'with non whitelisted input' do
|
81
|
-
let(:input) { input_b }
|
82
|
-
|
83
|
-
it { should be(true) }
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
describe Mutant::Predicate::Attribute::Equality do
|
90
|
-
instance_eval(&filter_helpers)
|
91
|
-
|
92
|
-
let(:object) { described_class.new(attribute_name, expected_value) }
|
93
|
-
let(:input) { double('Input', attribute_name => actual_value) }
|
94
|
-
|
95
|
-
let(:attribute_name) { :foo }
|
96
|
-
let(:expected_value) { 'value' }
|
97
|
-
|
98
|
-
describe '#match?' do
|
99
|
-
|
100
|
-
context 'not matching' do
|
101
|
-
let(:actual_value) { 'other-value' }
|
102
|
-
it { should be(false) }
|
103
|
-
end
|
104
|
-
|
105
|
-
context 'matching' do
|
106
|
-
let(:actual_value) { 'value' }
|
107
|
-
it { should be(true) }
|
108
|
-
end
|
109
|
-
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
describe Mutant::Predicate::Attribute::Regexp do
|
114
|
-
instance_eval(&filter_helpers)
|
115
|
-
|
116
|
-
let(:object) { described_class.new(attribute_name, expectation) }
|
117
|
-
let(:input) { double('Input', attribute_name => actual_value) }
|
118
|
-
|
119
|
-
let(:attribute_name) { :foo }
|
120
|
-
let(:expectation) { /\Avalue\z/ }
|
121
|
-
|
122
|
-
describe '#match?' do
|
123
|
-
|
124
|
-
context 'not matching' do
|
125
|
-
let(:actual_value) { 'other-value' }
|
126
|
-
it { should be(false) }
|
127
|
-
end
|
128
|
-
|
129
|
-
context 'matching' do
|
130
|
-
let(:actual_value) { 'value' }
|
131
|
-
it { should be(true) }
|
132
|
-
end
|
133
|
-
|
134
|
-
end
|
135
|
-
end
|