Skip to content

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

98 lines (83 sloc) 2.423 kb
require 'spec_helper'
describe 'Mutating booleans' do
context 'for a singleton method' do
context 'that contains `true`' do
before do
write_file 'thing.rb', """
class Thing
def self.alive?
true
end
end
"""
end
context 'with an expectation that the return value is true' do
before do
write_file 'spec/thing_spec.rb', """
require 'thing'
describe 'Thing.alive?' do
specify { Thing.should be_alive }
end
"""
mutate 'Thing.alive? 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 true or false' do
before do
write_file 'spec/thing_spec.rb', """
require 'thing'
describe 'Thing.alive?' do
specify { String(Thing.alive?).should =~ /true|false/ }
end
"""
mutate 'Thing.alive? spec/thing_spec.rb'
end
specify 'the mutation fails' do
all_output.should include('failed')
end
end
end
context 'that contains `false`' do
before do
write_file 'thing.rb', """
class Thing
def self.alive?
false
end
end
"""
end
context 'with an expectation that the return value is false' do
before do
write_file 'spec/thing_spec.rb', """
require 'thing'
describe 'Thing.alive?' do
specify { Thing.should_not be_alive }
end
"""
mutate 'Thing.alive? 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 true or false' do
before do
write_file 'spec/thing_spec.rb', """
require 'thing'
describe 'Thing.alive?' do
specify { String(Thing.alive?).should =~ /true|false/ }
end
"""
mutate 'Thing.alive? spec/thing_spec.rb'
end
specify 'the mutation fails' do
all_output.should include('failed')
end
end
end
end
end
Jump to Line
Something went wrong with that request. Please try again.