Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 190c48de2f
Fetching contributors…

Cannot retrieve contributors at this time

file 51 lines (44 sloc) 1.228 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
require 'spec_helper'

describe 'Mutating fixnums' do
  context 'for an instance method' do
    context 'that contains 42' do
      before do
        write_file 'life.rb', """
class Life
def 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.new.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.new.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
Something went wrong with that request. Please try again.