Sha256: bf1eef67654628cc20a750e5fd2d930bc4fff9bb8c2615a5e9e538edf03591b0

Contents?: true

Size: 1.24 KB

Versions: 2

Compression:

Stored size: 1.24 KB

Contents

require 'spec_helper'

describe 'Mutating fixnums' do
  context 'for a singleton method' do
    context 'that contains 42' do
      before do
        write_file 'life.rb', """
          class Life
            def self.answer
              42
            end
          end
        """
      end

      context 'with an expectation that the return value is 42' do
        before do
          write_file 'spec/life_spec.rb', """
            $: << '.'
            require 'life'

            describe 'Life.answer' do
              specify { Life.answer.should eq(42) }
            end
          """
          mutate 'Life.answer spec/life_spec.rb'
        end

        specify 'the mutation passes' do
          all_output.should include('passed')
        end
      end

      context 'with an expectation that the return value is a Fixnum' do
        before do
          write_file 'spec/life_spec.rb', """
            $: << '.'
            require 'life'

            describe 'Life.answer' do
              specify { Life.answer.should be_a(Fixnum) }
            end
          """
          mutate 'Life.answer spec/life_spec.rb'
        end

        specify 'the mutation fails' do
          all_output.should include('failed')
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mutant-0.1.1 spec/functional/singleton_method/fixnum_spec.rb
mutant-0.1.0 spec/functional/singleton_method/fixnum_spec.rb