free_mutant/spec/unit/mutant/mutator/define/mutation_spec.rb
Markus Schirp 583668138e Add mutations on singleton methods
* Fixing singleton matcher to return Rubiniuy::AST::DefineSingleton
  and not Rubinius::AST::DefineSingletonScope
* Adjust counts of runner spec
2012-08-16 19:10:24 +02:00

41 lines
994 B
Ruby

require 'spec_helper'
describe Mutant::Mutator, 'define' do
context 'with no arguments' do
let(:source) { 'def foo; self.bar; self.baz; end' }
let(:mutations) do
mutations = []
# Mutation of each statement in block
mutations << 'def foo; bar; self.baz; end'
mutations << 'def foo; self.bar; baz; end'
# Remove statement in block
mutations << 'def foo; self.baz; end'
mutations << 'def foo; self.bar; end'
end
it_should_behave_like 'a mutator'
end
context 'define on singleton' do
let(:source) { 'def self.foo; self.bar; self.baz; end' }
let(:mutations) do
mutations = []
# Body presence mutations
mutations << 'def self.foo; bar; self.baz; end'
mutations << 'def self.foo; self.bar; baz; end'
# Body presence mutations
mutations << 'def self.foo; self.bar; end'
mutations << 'def self.foo; self.baz; end'
end
it_should_behave_like 'a mutator'
end
end