Add Kernel#send => Kernel#public_send mutation

Closes #78
This commit is contained in:
Markus Schirp 2013-08-02 00:46:50 +02:00
parent dff4aa9277
commit 28cad68acc
2 changed files with 27 additions and 0 deletions

View file

@ -98,11 +98,24 @@ module Mutant
#
def normal_dispatch
emit_naked_receiver
emit_selector_mutations
mutate_receiver
emit_argument_propagation
mutate_arguments
end
# Emit selector mutations
#
# @return [undefined]
#
# @api private
#
def emit_selector_mutations
if selector == :send
emit_selector(:public_send)
end
end
# Emit naked receiver mutation
#
# @return [undefined]

View file

@ -5,6 +5,20 @@ require 'spec_helper'
# FIXME: This spec needs to be structured better!
describe Mutant::Mutator, 'send' do
context 'when using Kernel#send' do
let(:source) { 'foo.send(bar)' }
let(:mutations) do
mutations = []
mutations << 'foo.send'
mutations << 'foo.public_send(bar)'
mutations << 'bar'
mutations << 'foo'
end
it_should_behave_like 'a mutator'
end
context 'inside op assign' do
let(:source) { 'self.foo ||= expression' }