Skip to content

Commit

Permalink
Load spec_helper.rb for rspec strategies
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Schirp committed Jan 18, 2013
1 parent 62cf07f commit 3562d4f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
11 changes: 11 additions & 0 deletions lib/mutant/strategy/rspec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ class Rspec < self

KILLER = Killer::Forking.new(Killer::Rspec)

# Setup rspec strategy
#
# @return [self]
#
# @api private
#
def setup
require('./spec/spec_helper.rb')
self
end

# Run all unit specs per mutation
class Unit < self

Expand Down
6 changes: 3 additions & 3 deletions spec/integration/mutant/rspec_killer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
let(:strategy) { Mutant::Strategy::Rspec::DM2 }

specify 'allows to kill mutations' do
Kernel.system("bundle exec mutant -I lib -r test_app --rspec-dm2 ::TestApp::Literal#string").should be(true)
Kernel.system('bundle exec mutant --rspec-dm2 ::TestApp::Literal#string').should be(true)
end

specify 'fails to kill mutations when they are not covered' do
Kernel.system("bundle exec mutant -I lib -r test_app --rspec-dm2 ::TestApp::Literal#uncovered_string").should be(false)
Kernel.system('bundle exec mutant --rspec-dm2 ::TestApp::Literal#uncovered_string').should be(false)
end

specify 'fails when some mutations when are not covered' do
Kernel.system("bundle exec mutant -I lib -r test_app --rspec-dm2 ::TestApp::Literal").should be(false)
Kernel.system('bundle exec mutant --rspec-dm2 ::TestApp::Literal').should be(false)
end
end
3 changes: 3 additions & 0 deletions test_app/spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# encoding: utf-8

require 'rspec'

$: << File.join(File.dirname(__FILE__), 'lib')

require 'test_app'

# require spec support files and shared behavior
Expand Down

0 comments on commit 3562d4f

Please sign in to comment.