Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 190c48de2f
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 52 lines (44 sloc) 1.261 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 symbols' do
  context 'for a singleton method' do
    context 'that contains :foo' do
      before do
        write_file 'thing.rb', """
class Thing
def self.a_symbol
: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_symbol' do
specify { Thing.a_symbol.should eq(:foo) }
end
"""
          mutate 'Thing.a_symbol 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 symbol' do
        before do
          write_file 'spec/thing_spec.rb', """
require 'thing'

describe 'Thing.a_symbol' do
specify { Thing.a_symbol.should be_a(Symbol) }
end
"""
          mutate 'Thing.a_symbol spec/thing_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.