Sha256: 043ffa1a9dc6177f9461da150a6511f42db4ac00e1f6ad5ab687c006030394a2

Contents?: true

Size: 1.28 KB

Versions: 2

Compression:

Stored size: 1.28 KB

Contents

require 'spec_helper'

describe 'Mutating ranges' do
  context 'for a singleton method' do
    context 'that contains a..z' do
      before do
        write_file 'thing.rb', """
          class Thing
            def self.a_range
              'a'..'z'
            end
          end
        """
      end

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

            describe 'Thing#a_range' do
              specify { Thing.a_range.should eq('a'..'z') }
            end
          """
          mutate 'Thing.a_range 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 range" do
        before do
          write_file 'spec/thing_spec.rb', """
            $: << '.'
            require 'thing'

            describe 'Thing.a_string' do
              specify { Thing.a_range.should be_a(Range) }
            end
          """
          mutate 'Thing.a_range 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/singleton_method/range_spec.rb
mutant-0.1.0 spec/functional/singleton_method/range_spec.rb