Sha256: de9a107a5e573b0c4effbbee5462a17768cb6958d145cfcf827d3804482fb722

Contents?: true

Size: 1.6 KB

Versions: 5

Compression:

Stored size: 1.6 KB

Contents

require 'spec_helper'

describe Mutant::Mutator, 'super' do

  context 'with no arguments' do
    let(:source) { 'super' }

    let(:mutations) do
      mutations = []
      mutations << 'super()'
    end

    it_should_behave_like 'a mutator'
  end

  context 'with explicit empty arguments' do
    let(:source) { 'super()' }

    let(:mutations) do
      mutations = []
      mutations << 'super'
    end

    it_should_behave_like 'a mutator'
  end

  context 'with explicit empty arguments and block' do
    let(:source) { 'super() { foo; bar }' }

    let(:mutations) do
      mutations = []
      mutations << 'super() { foo }'
      mutations << 'super() { bar }'
      mutations << 'super() { }'
      mutations << 'super()'
      mutations << 'super'
    end

    it_should_behave_like 'a mutator'
  end

  context 'super with arguments' do
    let(:source) { 'super(foo, bar)' }

    let(:mutations) do
      mutations = []
      mutations << 'super'
      mutations << 'super()'
      mutations << 'super(foo)'
      mutations << 'super(bar)'
    end

    it_should_behave_like 'a mutator'
  end

  context 'super with arguments and block' do
    let(:source) { 'super(foo, bar) { foo; bar }' }

    let(:mutations) do
      mutations = []
      mutations << 'super(foo, bar) { foo; }'
      mutations << 'super(foo, bar) { bar; }'
      mutations << 'super(foo, bar) { nil }'
      mutations << 'super(foo, bar)'
      mutations << 'super'
      mutations << 'super(foo) { foo; bar }'
      mutations << 'super(bar) { foo; bar }'
      mutations << 'super() { foo; bar }'
    end

    it_should_behave_like 'a mutator'
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mutant-0.2.14 spec/unit/mutant/mutator/node/super/mutation_spec.rb
mutant-0.2.13 spec/unit/mutant/mutator/node/super/mutation_spec.rb
mutant-0.2.12 spec/unit/mutant/mutator/node/super/mutation_spec.rb
mutant-0.2.11 spec/unit/mutant/mutator/node/super/mutation_spec.rb
mutant-0.2.9 spec/unit/mutant/mutator/node/super/mutation_spec.rb