mutant 0.3.0.beta13 → 0.3.0.beta14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.devtools +5 -4
  3. data/circle.yml +4 -0
  4. data/config/flay.yml +1 -1
  5. data/lib/mutant/constants.rb +22 -4
  6. data/lib/mutant/mutator/node.rb +14 -0
  7. data/lib/mutant/mutator/node/generic.rb +6 -5
  8. data/lib/mutant/mutator/node/send.rb +16 -4
  9. data/lib/mutant/runner/config.rb +1 -1
  10. data/mutant.gemspec +2 -2
  11. data/spec/unit/mutant/cli/class_methods/new_spec.rb +2 -2
  12. data/spec/unit/mutant/cli/class_methods/run_spec.rb +6 -6
  13. data/spec/unit/mutant/cli/classifier/class_methods/build_spec.rb +5 -5
  14. data/spec/unit/mutant/context/scope/root_spec.rb +1 -1
  15. data/spec/unit/mutant/context/scope/unqualified_name_spec.rb +1 -1
  16. data/spec/unit/mutant/differ/class_methods/colorize_line_spec.rb +3 -0
  17. data/spec/unit/mutant/differ/diff_spec.rb +4 -4
  18. data/spec/unit/mutant/killer/rspec/class_methods/new_spec.rb +4 -4
  19. data/spec/unit/mutant/killer/success_predicate_spec.rb +4 -4
  20. data/spec/unit/mutant/loader/eval/class_methods/run_spec.rb +4 -4
  21. data/spec/unit/mutant/matcher/chain/each_spec.rb +4 -4
  22. data/spec/unit/mutant/matcher/chain/matchers_spec.rb +1 -1
  23. data/spec/unit/mutant/matcher/method/instance/class_methods/build_spec.rb +1 -1
  24. data/spec/unit/mutant/matcher/methods/instance/each_spec.rb +3 -3
  25. data/spec/unit/mutant/matcher/methods/singleton/each_spec.rb +3 -3
  26. data/spec/unit/mutant/matcher/namespace/each_spec.rb +5 -5
  27. data/spec/unit/mutant/mutator/node/send/mutation_spec.rb +11 -1
  28. data/spec/unit/mutant/runner/config/subjects_spec.rb +6 -6
  29. data/spec/unit/mutant/runner/config/success_predicate_spec.rb +6 -6
  30. data/spec/unit/mutant/runner/failed_predicte_spec.rb +1 -1
  31. data/spec/unit/mutant/runner/mutation/killer_spec.rb +5 -5
  32. data/spec/unit/mutant/runner/subject/success_predicate_spec.rb +6 -6
  33. data/spec/unit/mutant/strategy/rspec/dm2/lookup/method/instance/spec_files_spec.rb +5 -5
  34. data/spec/unit/mutant/strategy/rspec/dm2/lookup/method/singleton/spec_files_spec.rb +5 -5
  35. data/spec/unit/mutant/subject/context_spec.rb +2 -2
  36. data/spec/unit/mutant/subject/each_spec.rb +5 -5
  37. data/spec/unit/mutant/subject/node_spec.rb +2 -2
  38. metadata +5 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5100a60ae10ea74c7d5429d4c6f8ab4a8eb6d324
4
- data.tar.gz: d8c915c2bd55f043c2e6e7e39d41dfb67d0b9981
3
+ metadata.gz: c1b02e2a004b27eb4c96785f88d431d6f352ad5b
4
+ data.tar.gz: 12d62f0e44af09e2711244278c8cdfe67e512fa6
5
5
  SHA512:
6
- metadata.gz: e90198db8556ad4ee0f3b1e882f3a61b7cee31ecfd1b4c6357dccba3984522775dc7789a9d4d629f26a63550d5748676c19cbaf870d2756ee5cd41b65bf25912
7
- data.tar.gz: 91bcd04508b4924b334d09476be2f2ea4717ea817bea6cc39f3fb255fb072299eb7cfbffc3f62b0d73210b946ec60f3824e88c556b08e8a0d06c59db57fcc544
6
+ metadata.gz: f2cb7ddcbee74e216a95bed6f22fe576fadbe0230d06e08b8bd15ee933338029c0351dc9833925fb2cabb203d31b88d4b147ba98f584f1e04db75f7c3d8bca9d
7
+ data.tar.gz: 750a4ea68ad7d76e8b8f0d6a5825c9c16a703324c20c1e5bfcd46fea48a8620134b4d31cdf3cbcf02e1db5bc0f68957d6b23964f55647f3927dedd203edd0cb3
data/Gemfile.devtools CHANGED
@@ -3,17 +3,18 @@
3
3
  group :development do
4
4
  gem 'rake', '~> 10.1.0'
5
5
  gem 'rspec', '~> 2.13.0'
6
- gem 'yard', '~> 0.8.6.1'
6
+ gem 'yard', '~> 0.8.6.2'
7
7
  end
8
8
 
9
9
  group :yard do
10
- gem 'kramdown', '~> 1.0.1'
10
+ gem 'kramdown', '~> 1.1.0'
11
11
  end
12
12
 
13
13
  group :guard do
14
14
  gem 'guard', '~> 1.8.1'
15
15
  gem 'guard-bundler', '~> 1.0.0'
16
16
  gem 'guard-rspec', '~> 3.0.2'
17
+ gem 'guard-rubocop', '~> 0.2.0'
17
18
 
18
19
  # file system change event handling
19
20
  gem 'listen', '~> 1.2.2'
@@ -28,16 +29,16 @@ group :guard do
28
29
  end
29
30
 
30
31
  group :metrics do
31
- gem 'backports', '~> 3.3', '>= 3.3.2'
32
32
  gem 'coveralls', '~> 0.6.7'
33
33
  gem 'flay', '~> 2.3.0'
34
34
  gem 'flog', '~> 4.1.0'
35
35
  gem 'reek', '~> 1.3.1', :git => 'https://github.com/troessner/reek.git'
36
+ gem 'rubocop', '~> 0.9.1'
36
37
  gem 'simplecov', '~> 0.7.1'
37
38
  gem 'yardstick', '~> 0.9.6'
38
39
 
39
40
  platforms :ruby_19 do
40
- gem 'yard-spellcheck', '~> 0.1.5'
41
+ gem 'json', '~> 1.8.0'
41
42
  end
42
43
 
43
44
  platforms :rbx do
data/circle.yml ADDED
@@ -0,0 +1,4 @@
1
+ ---
2
+ test:
3
+ override:
4
+ - bundle exec rake ci
data/config/flay.yml CHANGED
@@ -1,3 +1,3 @@
1
1
  ---
2
2
  threshold: 16
3
- total_score: 680
3
+ total_score: 692
@@ -6,6 +6,20 @@ module Mutant
6
6
  '!' => '_bang'
7
7
  }.freeze
8
8
 
9
+ # Set of not assignable nodes
10
+ NOT_ASSIGNABLE = [
11
+ :int, :float, :str, :dstr, :class, :module, :self
12
+ ].to_set.freeze
13
+
14
+ # Set of op assign types
15
+ OP_ASSIGN = [
16
+ :or_asgn, :and_asgn
17
+ ].to_set.freeze
18
+
19
+ # Set of node types that are not valid when emitted standalone
20
+ NOT_STANDALONE = [ :splat, :block_pass ].to_set.freeze
21
+
22
+
9
23
  OPERATOR_EXPANSIONS = {
10
24
  :<=> => :spaceship_operator,
11
25
  :=== => :case_equality_operator,
@@ -42,9 +56,12 @@ module Mutant
42
56
  :~@, :+@, :-@, :'!'
43
57
  ].freeze
44
58
 
45
- BINARY_METHOD_OPERATORS = (OPERATOR_EXPANSIONS.keys - (INDEX_OPERATORS + UNARY_METHOD_OPERATORS)).to_set.freeze
59
+ BINARY_METHOD_OPERATORS = (
60
+ OPERATOR_EXPANSIONS.keys - (INDEX_OPERATORS + UNARY_METHOD_OPERATORS)
61
+ ).to_set.freeze
46
62
 
47
- OPERATOR_METHODS = OPERATOR_EXPANSIONS.keys + INDEX_OPERATORS + UNARY_METHOD_OPERATORS
63
+ OPERATOR_METHODS =
64
+ OPERATOR_EXPANSIONS.keys + INDEX_OPERATORS + UNARY_METHOD_OPERATORS
48
65
 
49
66
  # Hopefully all types parser does generate
50
67
  NODE_TYPES = [
@@ -61,6 +78,7 @@ module Mutant
61
78
  :xstr, :def, :defs, :case, :when, :ivar, :lvar, :cvar, :gvar,
62
79
  :back_ref, :const, :nth_ref, :class, :sclass, :yield,
63
80
  :match_with_lvasgn, :match_current_line, :irange, :erange,
64
- :or_asgn, :kwbegin
81
+ :or_asgn, :kwbegin, :and_asgn
65
82
  ].to_set.freeze
66
- end # Mutant,
83
+
84
+ end # Mutant
@@ -204,6 +204,20 @@ module Mutant
204
204
  end
205
205
  end
206
206
 
207
+ # Return parent type
208
+ #
209
+ # @return [Symbol] type
210
+ # if parent with type is presnet
211
+ #
212
+ # @return [nil]
213
+ # otherwise
214
+ #
215
+ # @api private
216
+ #
217
+ def parent_type
218
+ parent && parent.node.type
219
+ end
220
+
207
221
  end # Node
208
222
  end # Mutator
209
223
  end # Mutant
@@ -6,16 +6,17 @@ module Mutant
6
6
 
7
7
  handle(:self)
8
8
 
9
- # These nodes still need a dedicated mutator, your contribution is that close!
9
+ # These nodes still need a dedicated mutator,
10
+ # your contribution is that close!
10
11
  handle(
11
12
  :zsuper, :not, :or, :and, :defined,
12
13
  :next, :break, :match, :gvar, :cvar, :ensure,
13
14
  :dstr, :dsym, :yield, :rescue, :redo, :defined?,
14
- :lvar, :splat, :const, :blockarg, :block_pass, :op_asgn, :regopt,
15
- :ivar, :restarg, :casgn, :resbody, :retry, :arg_expr,
15
+ :lvar, :splat, :const, :blockarg, :block_pass, :op_asgn, :and_asgn,
16
+ :regopt, :ivar, :restarg, :casgn, :resbody, :retry, :arg_expr,
16
17
  :kwrestarg, :kwoptarg, :kwarg, :undef, :module, :cbase, :empty,
17
- :alias, :for, :xstr, :back_ref, :nth_ref, :class, :sclass, :match_with_lvasgn,
18
- :match_current_line, :or_asgn, :kwbegin
18
+ :alias, :for, :xstr, :back_ref, :nth_ref, :class,
19
+ :sclass, :match_with_lvasgn, :match_current_line, :or_asgn, :kwbegin
19
20
  )
20
21
 
21
22
  private
@@ -95,12 +95,26 @@ module Mutant
95
95
  # @api private
96
96
  #
97
97
  def normal_dispatch
98
- emit(receiver) if receiver
98
+ emit_naked_receiver
99
99
  mutate_receiver
100
100
  emit_argument_propagation
101
101
  mutate_arguments
102
102
  end
103
103
 
104
+ # Emit naked receiver mutation
105
+ #
106
+ # @return [undefined]
107
+ #
108
+ # @api private
109
+ #
110
+ def emit_naked_receiver
111
+ return unless receiver
112
+ op_assign = OP_ASSIGN.include?(parent_type)
113
+ not_assignable = NOT_ASSIGNABLE.include?(receiver.type)
114
+ return if op_assign and not_assignable
115
+ emit(receiver)
116
+ end
117
+
104
118
  # Test for binary operator
105
119
  #
106
120
  # @return [true]
@@ -130,8 +144,6 @@ module Mutant
130
144
  end
131
145
  end
132
146
 
133
- NO_PROPAGATE = [ :splat, :block_pass ].to_set
134
-
135
147
  # Emit argument propagation
136
148
  #
137
149
  # @return [undefined]
@@ -141,7 +153,7 @@ module Mutant
141
153
  def emit_argument_propagation
142
154
  return unless arguments.one?
143
155
  node = arguments.first
144
- return if NO_PROPAGATE.include?(node.type)
156
+ return if NOT_STANDALONE.include?(node.type)
145
157
  emit(arguments.first)
146
158
  end
147
159
 
@@ -59,7 +59,7 @@ module Mutant
59
59
  strategy = self.strategy
60
60
  strategy.setup
61
61
  @subjects = config.subjects.map do |subject|
62
- Subject.run(self, subject)
62
+ Subject.run(config, subject)
63
63
  end
64
64
  strategy.teardown
65
65
  end
data/mutant.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = 'mutant'
5
- gem.version = '0.3.0.beta13'
5
+ gem.version = '0.3.0.beta14'
6
6
  gem.authors = [ 'Markus Schirp' ]
7
7
  gem.email = [ 'mbj@schirp-dso.com' ]
8
8
 
@@ -16,7 +16,7 @@ Gem::Specification.new do |gem|
16
16
  gem.extra_rdoc_files = %w[TODO LICENSE]
17
17
  gem.executables = [ 'mutant', 'zombie' ]
18
18
 
19
- gem.add_runtime_dependency('parser', '~> 2.0.pre1')
19
+ gem.add_runtime_dependency('parser', '~> 2.0.pre2')
20
20
  gem.add_runtime_dependency('unparser', '~> 0.0.8')
21
21
  gem.add_runtime_dependency('ice_nine', '~> 0.8.0')
22
22
  gem.add_runtime_dependency('descendants_tracker', '~> 0.0.1')
@@ -77,7 +77,7 @@ describe Mutant::CLI, '.new' do
77
77
  end
78
78
 
79
79
  context 'with namespace matcher' do
80
- let(:arguments) { %w(--rspec-unit ::TestApp*) }
80
+ let(:arguments) { %w(--rspec-unit ::TestApp*) }
81
81
  let(:expected_matcher) { Mutant::CLI::Classifier::Namespace::Recursive.new(Mutant::Cache.new, '::TestApp*') }
82
82
 
83
83
  it_should_behave_like 'a cli parser'
@@ -94,7 +94,7 @@ describe Mutant::CLI, '.new' do
94
94
  end
95
95
 
96
96
  let(:expected_matcher) { Mutant::CLI::Classifier::Method.new(Mutant::Cache.new, 'TestApp::Literal#float') }
97
- let(:expected_filter) { Mutant::Mutation::Filter::Whitelist.new(filters) }
97
+ let(:expected_filter) { Mutant::Mutation::Filter::Whitelist.new(filters) }
98
98
 
99
99
  it_should_behave_like 'a cli parser'
100
100
  end
@@ -3,12 +3,12 @@ require 'spec_helper'
3
3
  describe Mutant::CLI, '.run' do
4
4
  subject { object.run(argv) }
5
5
 
6
- let(:object) { described_class }
7
- let(:argv) { mock('ARGV') }
8
- let(:attributes) { mock('Options') }
9
- let(:runner) { mock('Runner', :success? => success) }
10
- let(:config) { mock('Config') }
11
- let(:instance) { mock(described_class.name, :config => config) }
6
+ let(:object) { described_class }
7
+ let(:argv) { double('ARGV') }
8
+ let(:attributes) { double('Options') }
9
+ let(:runner) { double('Runner', :success? => success) }
10
+ let(:config) { double('Config') }
11
+ let(:instance) { double(described_class.name, :config => config) }
12
12
 
13
13
  before do
14
14
  described_class.stub(:new => instance)
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe Mutant::CLI::Classifier, '.build' do
4
4
  subject { described_class.build(cache, input) }
5
5
 
6
- let(:cache) { mock('Cache') }
6
+ let(:cache) { double('Cache') }
7
7
 
8
8
  this_spec = 'Mutant::CLI::Classifier.build'
9
9
 
@@ -12,25 +12,25 @@ describe Mutant::CLI::Classifier, '.build' do
12
12
  should eql(expected_class.new(cache, expected_class::REGEXP.match(input)))
13
13
  end
14
14
 
15
- let(:expected_class) { Mutant::CLI::Classifier::Method }
15
+ let(:expected_class) { Mutant::CLI::Classifier::Method }
16
16
  end
17
17
 
18
18
  context 'with explicit toplevel scope' do
19
19
 
20
- let(:input) { '::TestApp::Literal#string' }
20
+ let(:input) { '::TestApp::Literal#string' }
21
21
 
22
22
  it_should_behave_like this_spec
23
23
  end
24
24
 
25
25
  context 'with instance method notation' do
26
26
 
27
- let(:input) { 'TestApp::Literal#string' }
27
+ let(:input) { 'TestApp::Literal#string' }
28
28
 
29
29
  it_should_behave_like this_spec
30
30
  end
31
31
 
32
32
  context 'with singleton method notation' do
33
- let(:input) { 'TestApp::Literal.string' }
33
+ let(:input) { 'TestApp::Literal.string' }
34
34
 
35
35
  it_should_behave_like this_spec
36
36
  end
@@ -4,7 +4,7 @@ describe Mutant::Context::Scope, '#root' do
4
4
  subject { object.root(node) }
5
5
 
6
6
  let(:object) { described_class.new(TestApp::Literal, path) }
7
- let(:path) { mock('Path') }
7
+ let(:path) { double('Path') }
8
8
  let(:node) { parse(':node') }
9
9
 
10
10
  let(:scope) { subject.body }
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe Mutant::Context::Scope, '#unqualified_name' do
4
4
  subject { object.unqualified_name }
5
5
 
6
- let(:path) { mock('Path') }
6
+ let(:path) { double('Path') }
7
7
 
8
8
  context 'with top level constant name' do
9
9
  let(:object) { described_class.new(TestApp, path) }
@@ -7,16 +7,19 @@ describe Mutant::Differ, '.colorize_line' do
7
7
 
8
8
  context 'line beginning with "+"' do
9
9
  let(:line) { '+line' }
10
+
10
11
  it { should eql(Mutant::Color::GREEN.format(line)) }
11
12
  end
12
13
 
13
14
  context 'line beginning with "-"' do
14
15
  let(:line) { '-line' }
16
+
15
17
  it { should eql(Mutant::Color::RED.format(line)) }
16
18
  end
17
19
 
18
20
  context 'line beginning in other char' do
19
21
  let(:line) { ' line' }
22
+
20
23
  it { should eql(line) }
21
24
  end
22
25
  end
@@ -15,7 +15,7 @@ describe Mutant::Differ, '#diff' do
15
15
  end
16
16
 
17
17
  context 'when there is a diff NOT at begin of hunk' do
18
- let(:old) { %w(foo bar) }
18
+ let(:old) { %w(foo bar) }
19
19
  let(:new) { %w(foo baz bar) }
20
20
 
21
21
  it { should eql("@@ -1,3 +1,4 @@\n foo\n+baz\n bar\n") }
@@ -24,7 +24,7 @@ describe Mutant::Differ, '#diff' do
24
24
  end
25
25
 
26
26
  context 'when the diff has a long context at begin' do
27
- let(:old) { %w(foo bar baz boz a b c) }
27
+ let(:old) { %w(foo bar baz boz a b c) }
28
28
  let(:new) { %w(foo bar baz boz a b c other) }
29
29
 
30
30
  it { should eql("@@ -1,8 +1,9 @@\n foo\n bar\n baz\n boz\n a\n b\n c\n+other\n") }
@@ -34,7 +34,7 @@ describe Mutant::Differ, '#diff' do
34
34
 
35
35
  context 'when the diff has a long context at end, deleting' do
36
36
  let(:old) { %w(other foo bar baz boz a b c) }
37
- let(:new) { %w(foo bar baz boz a b c) }
37
+ let(:new) { %w(foo bar baz boz a b c) }
38
38
 
39
39
  it { should eql("@@ -1,9 +1,8 @@\n-other\n foo\n bar\n baz\n boz\n a\n b\n c\n") }
40
40
 
@@ -42,7 +42,7 @@ describe Mutant::Differ, '#diff' do
42
42
  end
43
43
 
44
44
  context 'when the diff has a long context at end, inserting' do
45
- let(:old) { %w(foo bar baz boz a b c) }
45
+ let(:old) { %w(foo bar baz boz a b c) }
46
46
  let(:new) { %w(other foo bar baz boz a b c) }
47
47
 
48
48
  it { should eql("@@ -1,8 +1,9 @@\n+other\n foo\n bar\n baz\n boz\n a\n b\n c\n") }
@@ -4,10 +4,10 @@ describe Mutant::Killer::Rspec, '.new' do
4
4
 
5
5
  subject { object.new(strategy, mutation) }
6
6
 
7
- let(:strategy) { mock('Strategy', :spec_files => ['foo'], :error_stream => $stderr, :output_stream => $stdout) }
8
- let(:context) { mock('Context') }
9
- let(:mutation) { mock('Mutation', :subject => mutation_subject) }
10
- let(:mutation_subject) { mock('Mutation Subject') }
7
+ let(:strategy) { double('Strategy', :spec_files => ['foo'], :error_stream => $stderr, :output_stream => $stdout) }
8
+ let(:context) { double('Context') }
9
+ let(:mutation) { double('Mutation', :subject => mutation_subject) }
10
+ let(:mutation_subject) { double('Mutation Subject') }
11
11
 
12
12
  let(:object) { described_class }
13
13
 
@@ -3,10 +3,10 @@ require 'spec_helper'
3
3
  describe Mutant::Killer, '#success?' do
4
4
  subject { object.success? }
5
5
 
6
- let(:object) { class_under_test.new(strategy, mutation) }
7
- let(:strategy) { mock('Strategy') }
8
- let(:mutation) { mock('Mutation', :success? => kill_state) }
9
- let(:kill_state) { mock('Kill State') }
6
+ let(:object) { class_under_test.new(strategy, mutation) }
7
+ let(:strategy) { double('Strategy') }
8
+ let(:mutation) { double('Mutation', :success? => kill_state) }
9
+ let(:kill_state) { double('Kill State') }
10
10
 
11
11
  before do
12
12
  kill_state.stub(:freeze => kill_state, :dup => kill_state)
@@ -4,10 +4,10 @@ describe Mutant::Loader::Eval, '.run' do
4
4
 
5
5
  subject { object.run(node, mutation_subject) }
6
6
 
7
- let(:object) { described_class }
8
- let(:mutation_subject) { mock('Subject', :source_path => path, :source_line => line) }
9
- let(:path) { 'test.rb' }
10
- let(:line) { 1 }
7
+ let(:object) { described_class }
8
+ let(:mutation_subject) { double('Subject', :source_path => path, :source_line => line) }
9
+ let(:path) { 'test.rb' }
10
+ let(:line) { 1 }
11
11
 
12
12
  let(:source) do
13
13
  <<-RUBY
@@ -7,11 +7,11 @@ describe Mutant::Matcher::Chain, '#each' do
7
7
 
8
8
  let(:matchers) { [matcher_a, matcher_b] }
9
9
 
10
- let(:matcher_a) { mock('Matcher A') }
11
- let(:matcher_b) { mock('Matcher B') }
10
+ let(:matcher_a) { double('Matcher A') }
11
+ let(:matcher_b) { double('Matcher B') }
12
12
 
13
- let(:subject_a) { mock('Subject A') }
14
- let(:subject_b) { mock('Subject B') }
13
+ let(:subject_a) { double('Subject A') }
14
+ let(:subject_b) { double('Subject B') }
15
15
 
16
16
  before do
17
17
  matcher_a.stub(:each).and_yield(subject_a).and_return(matcher_a)
@@ -4,7 +4,7 @@ describe Mutant::Matcher::Chain, '#matchers' do
4
4
  subject { object.matchers }
5
5
 
6
6
  let(:object) { described_class.new(matchers) }
7
- let(:matchers) { mock('Matchers') }
7
+ let(:matchers) { double('Matchers') }
8
8
 
9
9
  it { should be(matchers) }
10
10
 
@@ -5,7 +5,7 @@ describe Mutant::Matcher::Method::Instance, '.build' do
5
5
 
6
6
  subject { object.build(cache, scope, method) }
7
7
 
8
- let(:cache) { mock }
8
+ let(:cache) { double }
9
9
 
10
10
  let(:scope) do
11
11
  Class.new do
@@ -38,9 +38,9 @@ describe Mutant::Matcher::Methods::Instance, '#each' do
38
38
 
39
39
  end
40
40
 
41
- let(:subject_a) { mock('Subject A') }
42
- let(:subject_b) { mock('Subject B') }
43
- let(:subject_c) { mock('Subject C') }
41
+ let(:subject_a) { double('Subject A') }
42
+ let(:subject_b) { double('Subject B') }
43
+ let(:subject_c) { double('Subject C') }
44
44
 
45
45
  let(:subjects) { [subject_a, subject_b, subject_c] }
46
46
 
@@ -32,9 +32,9 @@ describe Mutant::Matcher::Methods::Singleton, '#each' do
32
32
 
33
33
  end
34
34
 
35
- let(:subject_a) { mock('Subject A') }
36
- let(:subject_b) { mock('Subject B') }
37
- let(:subject_c) { mock('Subject C') }
35
+ let(:subject_a) { double('Subject A') }
36
+ let(:subject_b) { double('Subject B') }
37
+ let(:subject_c) { double('Subject C') }
38
38
 
39
39
  let(:subjects) { [subject_a, subject_b, subject_c] }
40
40
 
@@ -3,15 +3,15 @@ require 'spec_helper'
3
3
  describe Mutant::Matcher::Namespace, '#each' do
4
4
  subject { object.each { |item| yields << item } }
5
5
 
6
- let(:yields) { [] }
6
+ let(:yields) { [] }
7
7
  let(:object) { described_class.new(cache, TestApp::Literal) }
8
8
 
9
9
  let(:cache) { Mutant::Cache.new }
10
10
 
11
- let(:singleton_a) { mock('SingletonA', :name => 'TestApp::Literal') }
12
- let(:singleton_b) { mock('SingletonB', :name => 'TestApp::Foo') }
13
- let(:subject_a) { mock('SubjectA') }
14
- let(:subject_b) { mock('SubjectB') }
11
+ let(:singleton_a) { double('SingletonA', :name => 'TestApp::Literal') }
12
+ let(:singleton_b) { double('SingletonB', :name => 'TestApp::Foo') }
13
+ let(:subject_a) { double('SubjectA') }
14
+ let(:subject_b) { double('SubjectB') }
15
15
 
16
16
  before do
17
17
  Mutant::Matcher::Methods::Singleton.stub(:each).with(cache, singleton_a).and_yield(subject_a)
@@ -3,6 +3,17 @@ require 'spec_helper'
3
3
  # FIXME: This spec needs to be structured better!
4
4
  describe Mutant::Mutator, 'send' do
5
5
 
6
+ context 'inside op assign' do
7
+ let(:source) { 'self.foo ||= expression' }
8
+
9
+ let(:mutations) do
10
+ mutations = []
11
+ mutations << 'foo ||= expression'
12
+ end
13
+
14
+ it_should_behave_like 'a mutator'
15
+ end
16
+
6
17
  context 'index assign' do
7
18
  let(:source) { 'foo[bar]=baz' }
8
19
 
@@ -14,7 +25,6 @@ describe Mutant::Mutator, 'send' do
14
25
  it_should_behave_like 'a mutator'
15
26
  end
16
27
 
17
-
18
28
  context 'with only a splat arg' do
19
29
  let(:source) { 'foo(*bar)' }
20
30
 
@@ -6,7 +6,7 @@ describe Mutant::Runner::Config, '#subjects' do
6
6
  subject { object.subjects }
7
7
 
8
8
  let(:config) do
9
- mock(
9
+ double(
10
10
  'Config',
11
11
  :subjects => [mutation_subject],
12
12
  :strategy => strategy,
@@ -14,10 +14,10 @@ describe Mutant::Runner::Config, '#subjects' do
14
14
  )
15
15
  end
16
16
 
17
- let(:reporter) { mock('Reporter') }
18
- let(:strategy) { mock('Strategy') }
19
- let(:mutation_subject) { mock('Mutation subject') }
20
- let(:subject_runner) { mock('Subject runner') }
17
+ let(:reporter) { double('Reporter') }
18
+ let(:strategy) { double('Strategy') }
19
+ let(:mutation_subject) { double('Mutation subject') }
20
+ let(:subject_runner) { double('Subject runner') }
21
21
 
22
22
  class DummySubjectRunner
23
23
  include Concord::Public.new(:config, :mutation)
@@ -32,7 +32,7 @@ describe Mutant::Runner::Config, '#subjects' do
32
32
  stub_const('Mutant::Runner::Subject', DummySubjectRunner)
33
33
  end
34
34
 
35
- it { should eql([DummySubjectRunner.new(object, mutation_subject)]) }
35
+ it { should eql([DummySubjectRunner.new(config, mutation_subject)]) }
36
36
 
37
37
  it_should_behave_like 'an idempotent method'
38
38
  end
@@ -6,7 +6,7 @@ describe Mutant::Runner::Config, '#success?' do
6
6
  let(:object) { described_class.run(config) }
7
7
 
8
8
  let(:config) do
9
- mock(
9
+ double(
10
10
  'Config',
11
11
  :reporter => reporter,
12
12
  :strategy => strategy,
@@ -14,11 +14,11 @@ describe Mutant::Runner::Config, '#success?' do
14
14
  )
15
15
  end
16
16
 
17
- let(:reporter) { mock('Reporter') }
18
- let(:strategy) { mock('Strategy') }
19
- let(:subjects) { [subject_a, subject_b] }
20
- let(:subject_a) { mock('Subject A', :fails? => false) }
21
- let(:subject_b) { mock('Subject B', :fails? => false) }
17
+ let(:reporter) { double('Reporter') }
18
+ let(:strategy) { double('Strategy') }
19
+ let(:subjects) { [subject_a, subject_b] }
20
+ let(:subject_a) { double('Subject A', :fails? => false) }
21
+ let(:subject_b) { double('Subject B', :fails? => false) }
22
22
 
23
23
  class DummySubjectRunner
24
24
  include Concord::Public.new(:config, :subject)
@@ -5,7 +5,7 @@ describe Mutant::Runner, '#failed?' do
5
5
 
6
6
  let(:object) { class_under_test.run(config) }
7
7
 
8
- let(:config) { mock('Config') }
8
+ let(:config) { double('Config') }
9
9
  let(:class_under_test) do
10
10
  success = self.success
11
11
 
@@ -4,17 +4,17 @@ describe Mutant::Runner::Mutation, '#killer' do
4
4
  let(:object) { described_class.run(config, mutation) }
5
5
 
6
6
  let(:config) do
7
- mock(
7
+ double(
8
8
  'Config',
9
9
  :reporter => reporter,
10
10
  :strategy => strategy
11
11
  )
12
12
  end
13
13
 
14
- let(:reporter) { mock('Reporter') }
15
- let(:mutation) { mock('Mutation') }
16
- let(:strategy) { mock('Strategy') }
17
- let(:killer) { mock('Killer') }
14
+ let(:reporter) { double('Reporter') }
15
+ let(:mutation) { double('Mutation') }
16
+ let(:strategy) { double('Strategy') }
17
+ let(:killer) { double('Killer') }
18
18
 
19
19
  subject { object.killer }
20
20
 
@@ -5,12 +5,12 @@ describe Mutant::Runner::Subject, '#success?' do
5
5
 
6
6
  let(:object) { described_class.run(config, mutation_subject) }
7
7
 
8
- let(:reporter) { mock('Reporter') }
9
- let(:mutation_subject) { mock('Subject', :map => mutations) }
10
- let(:config) { mock('Config', :reporter => reporter) }
11
- let(:mutation_a) { mock('Mutation A', :failed? => false) }
12
- let(:mutation_b) { mock('Mutation B', :failed? => false) }
13
- let(:mutations) { [mutation_a, mutation_b] }
8
+ let(:reporter) { double('Reporter') }
9
+ let(:mutation_subject) { double('Subject', :map => mutations) }
10
+ let(:config) { double('Config', :reporter => reporter) }
11
+ let(:mutation_a) { double('Mutation A', :failed? => false) }
12
+ let(:mutation_b) { double('Mutation B', :failed? => false) }
13
+ let(:mutations) { [mutation_a, mutation_b] }
14
14
 
15
15
  before do
16
16
  reporter.stub(:report => reporter)
@@ -3,11 +3,11 @@ require 'spec_helper'
3
3
  describe Mutant::Strategy::Rspec::DM2::Lookup::Method::Instance, '#spec_files' do
4
4
  subject { object.spec_files }
5
5
 
6
- let(:object) { described_class.new(mutation_subject) }
7
- let(:mutation_subject) { mock('Subject', :name => method_name, :public? => is_public, :context => context) }
8
- let(:context) { mock('Context', :name => 'Foo') }
9
- let(:method_name) { :bar }
10
- let(:files) { 'Files'.freeze }
6
+ let(:object) { described_class.new(mutation_subject) }
7
+ let(:mutation_subject) { double('Subject', :name => method_name, :public? => is_public, :context => context) }
8
+ let(:context) { double('Context', :name => 'Foo') }
9
+ let(:method_name) { :bar }
10
+ let(:files) { 'Files'.freeze }
11
11
 
12
12
  this_example_group = 'Mutant::Strategy::Rspec::DM2::Lookup::Method::Instance#spec_files'
13
13
 
@@ -4,11 +4,11 @@ describe Mutant::Strategy::Rspec::DM2::Lookup::Method::Singleton, '#spec_files'
4
4
 
5
5
  subject { object.spec_files }
6
6
 
7
- let(:object) { described_class.new(mutation_subject) }
8
- let(:mutation_subject) { mock('Subject', :name => method_name, :public? => is_public, :context => context) }
9
- let(:method_name) { :bar }
10
- let(:files) { 'Files'.freeze }
11
- let(:context) { mock('Context', :name => 'Foo') }
7
+ let(:object) { described_class.new(mutation_subject) }
8
+ let(:mutation_subject) { double('Subject', :name => method_name, :public? => is_public, :context => context) }
9
+ let(:method_name) { :bar }
10
+ let(:files) { 'Files'.freeze }
11
+ let(:context) { double('Context', :name => 'Foo') }
12
12
 
13
13
  this_example_group = 'Mutant::Strategy::Rspec::DM2::Lookup::Method::Singleton#spec_files'
14
14
 
@@ -8,8 +8,8 @@ describe Mutant::Subject, '#context' do
8
8
  end
9
9
 
10
10
  let(:object) { class_under_test.new(context, node) }
11
- let(:node) { mock('Node') }
12
- let(:context) { mock('Context') }
11
+ let(:node) { double('Node') }
12
+ let(:context) { double('Context') }
13
13
 
14
14
  it { should be(context) }
15
15
 
@@ -12,11 +12,11 @@ describe Mutant::Subject, '#each' do
12
12
 
13
13
  let(:object) { class_under_test.new(context, node) }
14
14
  let(:yields) { [] }
15
- let(:node) { mock('Node') }
16
- let(:context) { mock('Context') }
17
- let(:mutant) { mock('Mutant') }
18
- let(:mutation_a) { mock('Mutation A') }
19
- let(:mutation_b) { mock('Mutation B') }
15
+ let(:node) { double('Node') }
16
+ let(:context) { double('Context') }
17
+ let(:mutant) { double('Mutant') }
18
+ let(:mutation_a) { double('Mutation A') }
19
+ let(:mutation_b) { double('Mutation B') }
20
20
 
21
21
  it_should_behave_like 'an #each method'
22
22
 
@@ -8,8 +8,8 @@ describe Mutant::Subject, '#node' do
8
8
  end
9
9
 
10
10
  let(:object) { class_under_test.new(context, node) }
11
- let(:node) { mock('Node') }
12
- let(:context) { mock('Context') }
11
+ let(:node) { double('Node') }
12
+ let(:context) { double('Context') }
13
13
 
14
14
  it { should be(node) }
15
15
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mutant
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0.beta13
4
+ version: 0.3.0.beta14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Markus Schirp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-08 00:00:00.000000000 Z
11
+ date: 2013-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 2.0.pre1
19
+ version: 2.0.pre2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: 2.0.pre1
26
+ version: 2.0.pre2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: unparser
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -174,6 +174,7 @@ files:
174
174
  - TODO
175
175
  - bin/mutant
176
176
  - bin/zombie
177
+ - circle.yml
177
178
  - config/devtools.yml
178
179
  - config/flay.yml
179
180
  - config/flog.yml