mutant 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -11
- data/.rspec +0 -1
- data/.travis.yml +14 -3
- data/Changelog.md +3 -0
- data/Gemfile +5 -1
- data/Gemfile.devtools +49 -0
- data/Guardfile +18 -0
- data/README.md +67 -0
- data/Rakefile +4 -1
- data/TODO +13 -0
- data/bin/mutant +14 -0
- data/bin/zombie +14 -0
- data/config/flay.yml +3 -0
- data/config/flog.yml +2 -0
- data/config/roodi.yml +26 -0
- data/config/site.reek +93 -0
- data/config/yardstick.yml +2 -0
- data/lib/inflector.rb +7 -0
- data/lib/inflector/defaults.rb +62 -0
- data/lib/inflector/inflections.rb +209 -0
- data/lib/inflector/methods.rb +149 -0
- data/lib/inflector/version.rb +3 -0
- data/lib/mutant.rb +96 -21
- data/lib/mutant/cli.rb +309 -0
- data/lib/mutant/color.rb +61 -0
- data/lib/mutant/context.rb +36 -0
- data/lib/mutant/context/scope.rb +138 -0
- data/lib/mutant/differ.rb +100 -0
- data/lib/mutant/helper.rb +38 -0
- data/lib/mutant/killer.rb +136 -0
- data/lib/mutant/killer/forking.rb +41 -0
- data/lib/mutant/killer/rspec.rb +49 -0
- data/lib/mutant/killer/static.rb +19 -0
- data/lib/mutant/loader.rb +129 -0
- data/lib/mutant/matcher.rb +55 -0
- data/lib/mutant/matcher/chain.rb +66 -0
- data/lib/mutant/matcher/method.rb +173 -0
- data/lib/mutant/matcher/method/classifier.rb +126 -0
- data/lib/mutant/matcher/method/instance.rb +67 -0
- data/lib/mutant/matcher/method/singleton.rb +141 -0
- data/lib/mutant/matcher/object_space.rb +114 -0
- data/lib/mutant/matcher/scope_methods.rb +127 -0
- data/lib/mutant/mutation.rb +101 -12
- data/lib/mutant/mutation/filter.rb +75 -0
- data/lib/mutant/mutation/filter/code.rb +68 -0
- data/lib/mutant/mutation/filter/regexp.rb +39 -0
- data/lib/mutant/mutation/filter/whitelist.rb +47 -0
- data/lib/mutant/mutator.rb +134 -30
- data/lib/mutant/mutator/node.rb +163 -0
- data/lib/mutant/mutator/node/arguments.rb +24 -0
- data/lib/mutant/mutator/node/block.rb +24 -0
- data/lib/mutant/mutator/node/define.rb +24 -0
- data/lib/mutant/mutator/node/if_statement.rb +93 -0
- data/lib/mutant/mutator/node/literal.rb +54 -0
- data/lib/mutant/mutator/node/literal/array.rb +28 -0
- data/lib/mutant/mutator/node/literal/boolean.rb +49 -0
- data/lib/mutant/mutator/node/literal/dynamic.rb +24 -0
- data/lib/mutant/mutator/node/literal/empty_array.rb +26 -0
- data/lib/mutant/mutator/node/literal/fixnum.rb +37 -0
- data/lib/mutant/mutator/node/literal/float.rb +48 -0
- data/lib/mutant/mutator/node/literal/hash.rb +89 -0
- data/lib/mutant/mutator/node/literal/nil.rb +25 -0
- data/lib/mutant/mutator/node/literal/range.rb +94 -0
- data/lib/mutant/mutator/node/literal/regex.rb +43 -0
- data/lib/mutant/mutator/node/literal/string.rb +26 -0
- data/lib/mutant/mutator/node/literal/symbol.rb +26 -0
- data/lib/mutant/mutator/node/noop.rb +55 -0
- data/lib/mutant/mutator/node/receiver_case.rb +140 -0
- data/lib/mutant/mutator/node/return.rb +31 -0
- data/lib/mutant/mutator/node/send.rb +112 -0
- data/lib/mutant/mutator/registry.rb +48 -0
- data/lib/mutant/mutator/util.rb +87 -0
- data/lib/mutant/random.rb +24 -27
- data/lib/mutant/reporter.rb +48 -30
- data/lib/mutant/reporter/cli.rb +221 -0
- data/lib/mutant/reporter/null.rb +42 -0
- data/lib/mutant/reporter/stats.rb +64 -0
- data/lib/mutant/runner.rb +112 -0
- data/lib/mutant/strategy.rb +42 -0
- data/lib/mutant/strategy/rspec.rb +59 -0
- data/lib/mutant/strategy/rspec/example_lookup.rb +122 -0
- data/lib/mutant/subject.rb +115 -0
- data/lib/mutant/support/method_object.rb +31 -0
- data/locator.rb +87 -0
- data/mutant.gemspec +21 -21
- data/spec/integration/mutant/differ_spec.rb +15 -0
- data/spec/integration/mutant/loader_spec.rb +21 -0
- data/spec/integration/mutant/method_matching_spec.rb +269 -0
- data/spec/integration/mutant/rspec_killer_spec.rb +24 -0
- data/spec/integration/mutant/runner_spec.rb +26 -0
- data/spec/integration/mutant/zombie_spec.rb +8 -0
- data/spec/rcov.opts +7 -0
- data/spec/shared/command_method_behavior.rb +7 -0
- data/spec/shared/each_method_behaviour.rb +15 -0
- data/spec/shared/hash_method_behavior.rb +17 -0
- data/spec/shared/idempotent_method_behavior.rb +7 -0
- data/spec/shared/invertible_method_behaviour.rb +9 -0
- data/spec/shared/method_filter_parse_behavior.rb +16 -0
- data/spec/shared/method_match_behavior.rb +39 -0
- data/spec/shared/mutator_behavior.rb +46 -0
- data/spec/spec_helper.rb +11 -14
- data/spec/support/compress_helper.rb +10 -0
- data/spec/support/rspec.rb +22 -0
- data/spec/support/test_app.rb +5 -0
- data/spec/support/zombie.rb +141 -0
- data/spec/unit/mutant/cli/class_methods/new_spec.rb +87 -0
- data/spec/unit/mutant/cli/class_methods/run_spec.rb +38 -0
- data/spec/unit/mutant/context/root_spec.rb +11 -0
- data/spec/unit/mutant/context/scope/class_methods/build_spec.rb +29 -0
- data/spec/unit/mutant/context/scope/root_spec.rb +22 -0
- data/spec/unit/mutant/context/scope/unqualified_name_spec.rb +27 -0
- data/spec/unit/mutant/killer/fail_ques_spec.rb +39 -0
- data/spec/unit/mutant/killer/rspec/class_methods/new_spec.rb +32 -0
- data/spec/unit/mutant/loader/eval/class_methods/run_spec.rb +33 -0
- data/spec/unit/mutant/loader/rubinius/class_methods/run_spec.rb +42 -0
- data/spec/unit/mutant/matcher/chain/each_spec.rb +37 -0
- data/spec/unit/mutant/matcher/chain/matchers_spec.rb +12 -0
- data/spec/unit/mutant/matcher/class_methods/from_string_spec.rb +49 -0
- data/spec/unit/mutant/matcher/class_methods/parse_spec.rb +12 -0
- data/spec/unit/mutant/matcher/each_spec.rb +14 -0
- data/spec/unit/mutant/matcher/method/class_methods/parse_spec.rb +21 -0
- data/spec/unit/mutant/matcher/method/classifier/class_methods/run_spec.rb +34 -0
- data/spec/unit/mutant/matcher/method/method_spec.rb +11 -0
- data/spec/unit/mutant/matcher/object_space/class_methods/parse_spec.rb +24 -0
- data/spec/unit/mutant/matcher/object_space/each_spec.rb +31 -0
- data/spec/unit/mutant/mutator/each_spec.rb +25 -0
- data/spec/unit/mutant/mutator/emit_new_spec.rb +51 -0
- data/spec/unit/mutant/mutator/emit_spec.rb +52 -0
- data/spec/unit/mutant/mutator/node/block/mutation_spec.rb +36 -0
- data/spec/unit/mutant/mutator/node/define/mutation_spec.rb +47 -0
- data/spec/unit/mutant/mutator/node/if_statement/mutation_spec.rb +30 -0
- data/spec/unit/mutant/mutator/node/literal/array_spec.rb +30 -0
- data/spec/unit/mutant/mutator/node/literal/boolean/mutation_spec.rb +23 -0
- data/spec/unit/mutant/mutator/node/literal/empty_array_spec.rb +17 -0
- data/spec/unit/mutant/mutator/node/literal/fixnum_spec.rb +17 -0
- data/spec/unit/mutant/mutator/node/literal/float_spec.rb +25 -0
- data/spec/unit/mutant/mutator/node/literal/hash_spec.rb +34 -0
- data/spec/unit/mutant/mutator/node/literal/nil_spec.rb +13 -0
- data/spec/unit/mutant/mutator/node/literal/range_spec.rb +35 -0
- data/spec/unit/mutant/mutator/node/literal/regex_spec.rb +23 -0
- data/spec/unit/mutant/mutator/node/literal/string_spec.rb +17 -0
- data/spec/unit/mutant/mutator/node/literal/symbol_spec.rb +17 -0
- data/spec/unit/mutant/mutator/node/receiver_case/mutation_spec.rb +27 -0
- data/spec/unit/mutant/mutator/node/return/mutation_spec.rb +21 -0
- data/spec/unit/mutant/mutator/node/send/mutation_spec.rb +78 -0
- data/spec/unit/mutant/mutator/self_spec.rb +7 -0
- data/spec/unit/mutant/subject/class_methods/new_spec.rb +13 -0
- data/spec/unit/mutant/subject/context_spec.rb +14 -0
- data/spec/unit/mutant/subject/each_spec.rb +35 -0
- data/spec/unit/mutant/subject/node_spec.rb +13 -0
- data/tasks/metrics/ci.rake +7 -0
- data/tasks/metrics/flay.rake +41 -0
- data/tasks/metrics/flog.rake +43 -0
- data/tasks/metrics/heckle.rake +216 -0
- data/tasks/metrics/metric_fu.rake +31 -0
- data/tasks/metrics/reek.rake +15 -0
- data/tasks/metrics/roodi.rake +15 -0
- data/tasks/metrics/yardstick.rake +23 -0
- data/tasks/spec.rake +45 -0
- data/tasks/yard.rake +9 -0
- data/test_app/.rspec +1 -0
- data/test_app/lib/test_app.rb +5 -0
- data/test_app/lib/test_app/literal.rb +32 -0
- data/test_app/spec/shared/command_method_behavior.rb +7 -0
- data/test_app/spec/shared/each_method_behaviour.rb +15 -0
- data/test_app/spec/shared/hash_method_behavior.rb +17 -0
- data/test_app/spec/shared/idempotent_method_behavior.rb +7 -0
- data/test_app/spec/shared/invertible_method_behaviour.rb +9 -0
- data/test_app/spec/shared/method_filter_parse_behavior.rb +16 -0
- data/test_app/spec/shared/method_match_behavior.rb +39 -0
- data/test_app/spec/shared/mutator_behavior.rb +44 -0
- data/test_app/spec/spec_helper.rb +7 -0
- data/test_app/spec/unit/test_app/literal/command_spec.rb +9 -0
- data/test_app/spec/unit/test_app/literal/string_spec.rb +9 -0
- metadata +346 -124
- data/.rvmrc +0 -1
- data/Readme.md +0 -13
- data/exe/mutate +0 -6
- data/lib/mutant/extensions.rb +0 -8
- data/lib/mutant/formatter.rb +0 -19
- data/lib/mutant/implementation.rb +0 -70
- data/lib/mutant/literal.rb +0 -147
- data/lib/mutant/method.rb +0 -31
- data/lib/mutant/mutatee.rb +0 -61
- data/lib/mutant/node.rb +0 -26
- data/lib/mutant/runners/rspec.rb +0 -34
- data/lib/mutant/version.rb +0 -3
- data/spec/functional/class_spec.rb +0 -46
- data/spec/functional/instance_method/array_spec.rb +0 -53
- data/spec/functional/instance_method/boolean_spec.rb +0 -101
- data/spec/functional/instance_method/call_spec.rb +0 -161
- data/spec/functional/instance_method/fixnum_spec.rb +0 -53
- data/spec/functional/instance_method/float_spec.rb +0 -53
- data/spec/functional/instance_method/hash_spec.rb +0 -53
- data/spec/functional/instance_method/if_spec.rb +0 -57
- data/spec/functional/instance_method/ivar_assign_spec.rb +0 -62
- data/spec/functional/instance_method/range_spec.rb +0 -53
- data/spec/functional/instance_method/regex_spec.rb +0 -55
- data/spec/functional/instance_method/string_spec.rb +0 -53
- data/spec/functional/instance_method/symbol_spec.rb +0 -53
- data/spec/functional/reporter/method_loaded_spec.rb +0 -62
- data/spec/functional/reporter/running_mutations_spec.rb +0 -60
- data/spec/functional/runners/rspec_spec.rb +0 -26
- data/spec/functional/singleton_method/array_spec.rb +0 -53
- data/spec/functional/singleton_method/boolean_spec.rb +0 -101
- data/spec/functional/singleton_method/call_spec.rb +0 -161
- data/spec/functional/singleton_method/fixnum_spec.rb +0 -53
- data/spec/functional/singleton_method/float_spec.rb +0 -53
- data/spec/functional/singleton_method/hash_spec.rb +0 -53
- data/spec/functional/singleton_method/if_spec.rb +0 -57
- data/spec/functional/singleton_method/ivar_assign_spec.rb +0 -60
- data/spec/functional/singleton_method/range_spec.rb +0 -53
- data/spec/functional/singleton_method/regex_spec.rb +0 -55
- data/spec/functional/singleton_method/string_spec.rb +0 -53
- data/spec/functional/singleton_method/symbol_spec.rb +0 -53
- data/spec/mutant/extensions_spec.rb +0 -13
- data/spec/mutant/implementation_spec.rb +0 -223
- data/spec/mutant/literal_spec.rb +0 -129
- data/spec/mutant/mutatee_spec.rb +0 -28
- data/spec/mutant/node_spec.rb +0 -41
- data/spec/mutant/random_spec.rb +0 -33
- data/spec/mutant/reporter_spec.rb +0 -17
- data/spec/mutant_spec.rb +0 -28
- data/spec/support/example_group_helpers.rb +0 -11
- data/spec/support/example_helpers.rb +0 -5
data/spec/mutant/literal_spec.rb
DELETED
@@ -1,129 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Mutant::Literal do
|
4
|
-
describe '.literal_class' do
|
5
|
-
context 'given an instance of Rubinius::AST::TrueLiteral' do
|
6
|
-
let(:true_literal) { Rubinius::AST::TrueLiteral.new(1) }
|
7
|
-
|
8
|
-
it 'returns the Mutant::Rbx::Literal::TrueLiteral class' do
|
9
|
-
Mutant::Literal.literal_class(true_literal).should eq(
|
10
|
-
Mutant::Literal::TrueLiteral
|
11
|
-
)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
describe '#swap' do
|
17
|
-
context 'initialized with an instance of Rubinius::AST::TrueLiteral' do
|
18
|
-
let(:true_literal) { Rubinius::AST::TrueLiteral.new(1) }
|
19
|
-
|
20
|
-
it 'calls Mutant::Rbx::Literal::TrueLiteral#swap' do
|
21
|
-
Mutant::Literal::TrueLiteral.should_receive(:new).with(true_literal) {
|
22
|
-
double(Mutant::Literal::TrueLiteral, :swap => true)
|
23
|
-
}
|
24
|
-
Mutant::Literal.new(true_literal).swap
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
describe Mutant::Literal::FalseLiteral do
|
30
|
-
describe '#swap' do
|
31
|
-
let(:node) { double('node', :line => 1) }
|
32
|
-
|
33
|
-
it 'returns an instance of Rubinius::AST::TrueLiteral' do
|
34
|
-
Mutant::Literal::FalseLiteral.new(node).swap.should be_an_instance_of(
|
35
|
-
Rubinius::AST::TrueLiteral
|
36
|
-
)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
describe Mutant::Literal::TrueLiteral do
|
42
|
-
describe '#swap' do
|
43
|
-
let(:node) { double('node', :line => 1) }
|
44
|
-
|
45
|
-
it 'returns an instance of Rubinius::AST::FalseLiteral' do
|
46
|
-
Mutant::Literal::TrueLiteral.new(node).swap.should be_an_instance_of(
|
47
|
-
Rubinius::AST::FalseLiteral
|
48
|
-
)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
describe Mutant::Literal::SymbolLiteral do
|
54
|
-
describe '#swap' do
|
55
|
-
let(:node) { double('node') }
|
56
|
-
|
57
|
-
it "sets the node's value to a random symbol" do
|
58
|
-
node.should_receive(:value=).with(instance_of(Symbol))
|
59
|
-
Mutant::Literal::SymbolLiteral.new(node).swap.should eq(node)
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
describe Mutant::Literal::StringLiteral do
|
65
|
-
describe '#swap' do
|
66
|
-
let(:node) { double('node') }
|
67
|
-
|
68
|
-
it "sets the node's string to a random string" do
|
69
|
-
node.should_receive(:string=).with(instance_of(String))
|
70
|
-
Mutant::Literal::StringLiteral.new(node).swap.should eq(node)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
describe Mutant::Literal::FixnumLiteral do
|
76
|
-
describe '#swap' do
|
77
|
-
let(:node) { double('node') }
|
78
|
-
|
79
|
-
it "sets the node's value to a random fixnum" do
|
80
|
-
node.should_receive(:value=).with(instance_of(Fixnum))
|
81
|
-
Mutant::Literal::FixnumLiteral.new(node).swap.should eq(node)
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
describe Mutant::Literal::FloatLiteral do
|
87
|
-
describe '#swap' do
|
88
|
-
let(:node) { double('node') }
|
89
|
-
|
90
|
-
it "sets the node's value to a random float" do
|
91
|
-
node.should_receive(:value=).with(instance_of(Float))
|
92
|
-
Mutant::Literal::FloatLiteral.new(node).swap.should eq(node)
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
describe Mutant::Literal::Range do
|
98
|
-
describe '#swap' do
|
99
|
-
let(:node) { double('node', :line => 1) }
|
100
|
-
|
101
|
-
it "sets the node's start and finish to an instance of Rubinius::AST::FixnumLiteral" do
|
102
|
-
node.should_receive(:start=).with(
|
103
|
-
instance_of(Rubinius::AST::FixnumLiteral)
|
104
|
-
)
|
105
|
-
node.should_receive(:finish=).with(
|
106
|
-
instance_of(Rubinius::AST::FixnumLiteral)
|
107
|
-
)
|
108
|
-
Mutant::Literal::Range.new(node).swap.should eq(node)
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
describe Mutant::Literal::LocalVariableAssignment do
|
114
|
-
describe '#swap' do
|
115
|
-
context "with the node's value set to an instance of Rubinius::AST::TrueLiteral" do
|
116
|
-
let(:node) do
|
117
|
-
double('node', :value => Rubinius::AST::TrueLiteral.new(1))
|
118
|
-
end
|
119
|
-
|
120
|
-
it "sets the node's value to an instance of Rubinius::AST::FalseLiteral" do
|
121
|
-
node.should_receive(:value=).with(
|
122
|
-
instance_of(Rubinius::AST::FalseLiteral)
|
123
|
-
)
|
124
|
-
Mutant::Literal::LocalVariableAssignment.new(node).swap.should eq(node)
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|
data/spec/mutant/mutatee_spec.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Mutant::Mutatee do
|
4
|
-
describe '#rbx_method' do
|
5
|
-
setup_thing do
|
6
|
-
def self.bar; end
|
7
|
-
def bar; end
|
8
|
-
end
|
9
|
-
|
10
|
-
context 'given an implementation for a singleton method' do
|
11
|
-
let(:implementation) { Mutant::Implementation.new('Thing.bar') }
|
12
|
-
let(:mutatee) { Mutant::Mutatee.new(implementation) }
|
13
|
-
|
14
|
-
it 'returns a SingletonMethod' do
|
15
|
-
mutatee.rbx_method.should be_an_instance_of(Mutant::SingletonMethod)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
context 'given an implementation for an instance method' do
|
20
|
-
let(:implementation) { Mutant::Implementation.new('Thing#bar') }
|
21
|
-
let(:mutatee) { Mutant::Mutatee.new(implementation) }
|
22
|
-
|
23
|
-
it 'returns an InstanceMethod' do
|
24
|
-
mutatee.rbx_method.should be_an_instance_of(Mutant::InstanceMethod)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
data/spec/mutant/node_spec.rb
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Mutant::Node do
|
4
|
-
let(:item) { double('item', :line => 1) }
|
5
|
-
let(:node) { Mutant::Node.new(item) }
|
6
|
-
|
7
|
-
describe '#line' do
|
8
|
-
it "returns the item's line" do
|
9
|
-
Mutant::Node.new(item).line.should eq 1
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
describe '#from' do
|
14
|
-
it "returns a Formatter instance with its item set to the node's item" do
|
15
|
-
formatter = node.from
|
16
|
-
formatter.should be_an_instance_of(Mutant::Formatter)
|
17
|
-
formatter.item.should eq(item)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
describe '#to' do
|
22
|
-
it "returns a Formatter instance with its item set to the node's copy" do
|
23
|
-
formatter = node.to
|
24
|
-
formatter.should be_an_instance_of(Mutant::Formatter)
|
25
|
-
formatter.item.should eq(node.copy)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
describe '#swap' do
|
30
|
-
let(:swap) { double('swap') }
|
31
|
-
let(:literal) { double('literal', :swap => swap) }
|
32
|
-
|
33
|
-
before do
|
34
|
-
Mutant::Literal.should_receive(:new).with(node.copy).and_return(literal)
|
35
|
-
end
|
36
|
-
|
37
|
-
it "sets the node's copy to a different Literal" do
|
38
|
-
expect { node.swap }.to change { node.copy }.to swap
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
data/spec/mutant/random_spec.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Mutant::Random do
|
4
|
-
describe '.string' do
|
5
|
-
it 'returns a random string' do
|
6
|
-
Mutant::Random.string.should be_a(String)
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
describe '.symbol' do
|
11
|
-
it 'returns a random symbol' do
|
12
|
-
Mutant::Random.symbol.should be_a(Symbol)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
describe '.fixnum' do
|
17
|
-
it 'returns a random fixnum' do
|
18
|
-
Mutant::Random.fixnum.should be_a(Fixnum)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
describe '.float' do
|
23
|
-
it 'returns a random float' do
|
24
|
-
Mutant::Random.float.should be_a(Float)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe '.range' do
|
29
|
-
it 'returns a random range' do
|
30
|
-
Mutant::Random.range.should be_a(Range)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Mutant::Reporter do
|
4
|
-
describe '.pluralize' do
|
5
|
-
context 'given "mutant" with a count of 1' do
|
6
|
-
it 'returns "mutant"' do
|
7
|
-
Mutant::Reporter.pluralize(1, 'mutant').should eq('mutant')
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
context 'given "mutant" with a count of 0' do
|
12
|
-
it 'returns "mutants"' do
|
13
|
-
Mutant::Reporter.pluralize(0, 'mutant').should eq('mutants')
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
data/spec/mutant_spec.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Mutant do
|
4
|
-
describe '.run' do
|
5
|
-
it 'runs the RSpec runner with the given arguments' do
|
6
|
-
Mutant::Runners::RSpec.should_receive(:run).with(:foo)
|
7
|
-
Mutant.run(:foo)
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
describe '.mutate' do
|
12
|
-
context 'given an implementation' do
|
13
|
-
let(:mutatee) { double('mutatee') }
|
14
|
-
let(:implementation) { double('implementation') }
|
15
|
-
let(:mutator) { double('mutator') }
|
16
|
-
|
17
|
-
before do
|
18
|
-
mutator.should_receive(:mutate)
|
19
|
-
implementation.should_receive(:mutatees).and_return([mutatee])
|
20
|
-
end
|
21
|
-
|
22
|
-
it "mutates each of the implementation's mutatees" do
|
23
|
-
Mutant::Mutator.should_receive(:new).with(mutatee).and_return(mutator)
|
24
|
-
Mutant.mutate(implementation)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|