Sha256: d3a1458ae751b1f3faff2740313ecca195e3174b64d464809864fc10ca8f2c4c

Contents?: true

Size: 1.68 KB

Versions: 22

Compression:

Stored size: 1.68 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Mutant::Mutator::Node::NamedValue::Access, 'mutations' do
  before do
    Mutant::Random.stub(hex_string: 'random')
  end

  context 'global variable' do
    let(:source) { '$a = nil; $a' }

    let(:mutations) do
      mutants = []
      mutants << '$a = nil; nil'
      mutants << '$a = nil'
      mutants << '$a'
      mutants << '$a = ::Object.new; $a'
      mutants << '$srandom = nil; $a'
      mutants << 'nil; $a'
    end

    it_should_behave_like 'a mutator'
  end

  context 'class variable' do
    let(:source) { '@@a = nil; @@a' }

    let(:mutations) do
      mutants = []
      mutants << '@@a = nil; nil'
      mutants << '@@a = nil'
      mutants << '@@a'
      mutants << '@@a = ::Object.new; @@a'
      mutants << '@@srandom = nil; @@a'
      mutants << 'nil; @@a'
    end
  end

  context 'instance variable' do
    let(:source) { '@a = nil; @a' }

    let(:mutations) do
      mutants = []
      mutants << '@a = nil; nil'
      mutants << '@a = nil'
      mutants << '@a'
      mutants << '@a = ::Object.new; @a'
      mutants << '@srandom = nil; @a'
      mutants << 'nil; @a'
    end

    it_should_behave_like 'a mutator'
  end

  context 'local variable' do
    let(:source) { 'a = nil; a' }

    let(:mutations) do
      mutants = []
      mutants << 'a = nil; nil'
      mutants << 'a = nil'
      mutants << 'a'
      mutants << 'a = ::Object.new; a'
      mutants << 'srandom = nil; a'
      mutants << 'nil; a'
    end

    it_should_behave_like 'a mutator'
  end

  context 'self' do
    let(:source) { 'self' }

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

    it_should_behave_like 'a mutator'
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
mutant-0.5.10 spec/unit/mutant/mutator/node/named_value/access_spec.rb
mutant-0.5.9 spec/unit/mutant/mutator/node/named_value/access_spec.rb
mutant-0.5.8 spec/unit/mutant/mutator/node/named_value/access_spec.rb
mutant-0.5.7 spec/unit/mutant/mutator/node/named_value/access_spec.rb
mutant-0.5.6 spec/unit/mutant/mutator/node/named_value/access_spec.rb
mutant-0.5.5 spec/unit/mutant/mutator/node/named_value/access_spec.rb
mutant-0.5.4 spec/unit/mutant/mutator/node/named_value/access_spec.rb
mutant-0.5.3 spec/unit/mutant/mutator/node/named_value/access_spec.rb
mutant-0.5.2 spec/unit/mutant/mutator/node/named_value/access_spec.rb
mutant-0.5.1 spec/unit/mutant/mutator/node/named_value/access_spec.rb
mutant-0.5.0 spec/unit/mutant/mutator/node/named_value/access_spec.rb
mutant-0.3.6 spec/unit/mutant/mutator/node/named_value/access_spec.rb
mutant-0.3.5 spec/unit/mutant/mutator/node/named_value/access_spec.rb
mutant-0.3.4 spec/unit/mutant/mutator/node/named_value/access_spec.rb
mutant-0.3.3 spec/unit/mutant/mutator/node/named_value/access_spec.rb
mutant-0.3.2 spec/unit/mutant/mutator/node/named_value/access_spec.rb
mutant-0.3.1 spec/unit/mutant/mutator/node/named_value/access/mutation_spec.rb
mutant-0.3.0 spec/unit/mutant/mutator/node/named_value/access/mutation_spec.rb
mutant-0.3.0.rc5 spec/unit/mutant/mutator/node/named_value/access/mutation_spec.rb
mutant-0.3.0.rc4 spec/unit/mutant/mutator/node/named_value/access/mutation_spec.rb