Sha256: 03c51c00ad4195aec76c4a94afc07bfcb9a1e39cd1e1c7da3b5023481bca49bc

Contents?: true

Size: 1.1 KB

Versions: 4

Compression:

Stored size: 1.1 KB

Contents

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'

      # Remove all statements
      mutations << 'def foo; 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'

      # Remove all statements
      mutations << 'def self.foo; end'
    end

    it_should_behave_like 'a mutator'
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

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