Sha256: e7c61a015e3709f71ba3cd0cfde1a0564cb683925499818074d750728a4aa8ec

Contents?: true

Size: 1.5 KB

Versions: 6

Compression:

Stored size: 1.5 KB

Contents

require 'spec_helper'

describe Mutant::Mutator, 'block' do
  context 'with block' do
    let(:source) { 'foo() { a; b }' }

    let(:mutations) do
      mutations = []
      mutations << 'foo { a }'
      mutations << 'foo { b }'
      mutations << 'foo {}'
      mutations << 'foo'
    end

    it_should_behave_like 'a mutator'
  end

  context 'with block args' do

    let(:source) { 'foo { |a, b| }' }

    before do
      Mutant::Random.stub(:hex_string => :random)
    end

    let(:mutations) do
      mutations = []
      mutations << 'foo'
      mutations << 'foo { |a, b| ::Object.new }'
      mutations << 'foo { |a, srandom| }'
      mutations << 'foo { |srandom, b| }'
      mutations << 'foo { |a| }'
      mutations << 'foo { |b| }'
      mutations << 'foo { || }'
    end

    it_should_behave_like 'a mutator'
  end

  context 'with block pattern args' do

    before do
      Mutant::Random.stub(:hex_string => :random)
    end

    let(:source) { 'foo { |(a, b), c| }' }

    let(:mutations) do
      mutations = []
      mutations << 'foo { || }'
      mutations << 'foo { |a, b, c| }'
      mutations << 'foo { |(a, b), c| ::Object.new }'
      mutations << 'foo { |(a), c| }'
      mutations << 'foo { |(b), c| }'
      mutations << 'foo { |(a, b)| }'
      mutations << 'foo { |c| }'
      mutations << 'foo { |(srandom, b), c| }'
      mutations << 'foo { |(a, srandom), c| }'
      mutations << 'foo { |(a, b), srandom| }'
      mutations << 'foo'
    end

    it_should_behave_like 'a mutator'
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mutant-0.3.0.beta7 spec/unit/mutant/mutator/node/block/mutation_spec.rb
mutant-0.3.0.beta6 spec/unit/mutant/mutator/node/block/mutation_spec.rb
mutant-0.3.0.beta5 spec/unit/mutant/mutator/node/block/mutation_spec.rb
mutant-0.3.0.beta4 spec/unit/mutant/mutator/node/block/mutation_spec.rb
mutant-0.3.0.beta3 spec/unit/mutant/mutator/node/block/mutation_spec.rb
mutant-0.3.0.beta2 spec/unit/mutant/mutator/node/block/mutation_spec.rb