Sha256: b770f8627c7aae5ef8ca48cdfa71ab3d2c0a9c277c7e176ef99ee92a33398f86

Contents?: true

Size: 1.28 KB

Versions: 2

Compression:

Stored size: 1.28 KB

Contents

require 'spec_helper'

describe 'Mutating strings' do
  context 'for an instance method' do
    context 'that contains "foo"' do
      before do
        write_file 'thing.rb', """
          class Thing
            def a_string
              'foo'
            end
          end
        """
      end

      context 'with an expectation that the return value is "foo"' do
        before do
          write_file 'spec/thing_spec.rb', """
            $: << '.'
            require 'thing'

            describe 'Thing#a_string' do
              specify { Thing.new.a_string.should eq('foo') }
            end
          """
          mutate 'Thing#a_string spec/thing_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 string' do
        before do
          write_file 'spec/thing_spec.rb', """
            $: << '.'
            require 'thing'

            describe 'Thing#a_string' do
              specify { Thing.new.a_string.should be_a(String) }
            end
          """
          mutate 'Thing#a_string spec/thing_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/instance_method/string_spec.rb
mutant-0.1.0 spec/functional/instance_method/string_spec.rb