Sha256: 58fff0f8cb73386e416a7d632a8b8dca3bd0417db437716c85e570e1d62fbf30

Contents?: true

Size: 1.71 KB

Versions: 5

Compression:

Stored size: 1.71 KB

Contents

require 'spec_helper'

describe Mutant::Mutator, 'call' do
  context 'send without arguments' do
    # This could not be reproduced in a test case but happens in the mutant source code?
    context 'block given' do
      context 'implicit self' do
        let(:source) { 'block_given?' }

        it_should_behave_like 'a noop mutator'
      end
      
      context 'explicit self' do
        let(:source) { 'self.block_given?' }

        it_should_behave_like 'a noop mutator'
      end
    end

    context 'with self as receiver' do

      context 'implicit' do
        let(:source) { 'foo' }

        it_should_behave_like 'a noop mutator'
      end

      context 'explict' do
        let(:source) { 'self.foo' }

        let(:mutations) do
          mutations = []
          # with implicit receiver (send privately)
          mutations << 'foo' 
        end

        it_should_behave_like 'a mutator'
      end
    end

    context 'to some object' do
      let(:source) { '1.foo' }

      it_should_behave_like 'a noop mutator'
    end
  end

  context 'send with arguments' do

    context 'with self as receiver' do
      context 'implicit' do
        let(:source) { 'foo(nil)' }

        let(:mutations) do 
          mutations = []
          mutations << 'foo()'
          mutations << 'foo(Object.new)'
        end

        it_should_behave_like 'a mutator'
      end

      context 'explicit' do
        let(:source) { 'self.foo(nil)' }

        let(:mutations) do
          mutations = []
          # with implicit receiver (send privately)
          mutations << 'foo(nil)'
          mutations << 'self.foo(Object.new)'
          mutations << 'self.foo()'
        end

        it_should_behave_like 'a mutator'
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mutant-0.2.4 spec/unit/mutant/mutator/node/send/mutation_spec.rb
mutant-0.2.3 spec/unit/mutant/mutator/node/send/mutation_spec.rb
mutant-0.2.2 spec/unit/mutant/mutator/node/send/mutation_spec.rb
mutant-0.2.1 spec/unit/mutant/mutator/node/send/mutation_spec.rb
mutant-0.2.0 spec/unit/mutant/mutator/node/send/mutation_spec.rb