Sha256: 6ae3187b90044817a886e312bd64a7e1d4a552ee191d92acd755b368f989cac0

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 KB

Contents

# encoding: utf-8

require 'spec_helper'

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

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

    let(:mutations) do
      mutations = []

      mutations << '$srandom = true'
      mutations << '$a = false'
      mutations << '$a = nil'
    end

    it_should_behave_like 'a mutator'
  end

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

    let(:mutations) do
      mutations = []

      mutations << '@@srandom = true'
      mutations << '@@a = false'
      mutations << '@@a = nil'
    end

    it_should_behave_like 'a mutator'
  end

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

    let(:mutations) do
      mutations = []

      mutations << '@srandom = true'
      mutations << '@a = false'
      mutations << '@a = nil'
    end

    it_should_behave_like 'a mutator'
  end

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

    let(:mutations) do
      mutations = []

      mutations << 'srandom = true'
      mutations << 'a = false'
      mutations << 'a = nil'
    end

    it_should_behave_like 'a mutator'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mutant-0.3.0.rc1 spec/unit/mutant/mutator/node/named_value/variable_assignment/mutation_spec.rb
mutant-0.3.0.beta22 spec/unit/mutant/mutator/node/named_value/variable_assignment/mutation_spec.rb