Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Publish exit status of CLI runner in executable

  • Loading branch information...
commit 7a471875fce1f0c88c75c9725550b10f22839187 1 parent 70060ca
Markus Schirp authored
View
2  bin/mutant
@@ -11,4 +11,4 @@ namespace =
Mutant
end
-namespace::CLI.run(ARGV)
+Kernel.exit(namespace::CLI.run(ARGV))
View
10 lib/mutant/matcher/method.rb
@@ -1,6 +1,6 @@
module Mutant
class Matcher
- # Matcher to find AST for method
+ # Matcher for subjects that are a specific method
class Method < self
include Adamantium::Flat, Equalizer.new(:identification)
@@ -123,14 +123,6 @@ def source_location
method.source_location
end
- # Return matched node
- #
- # @return [Rubinis::AST::Node]
- #
- # @api private
- #
- abstract_method :matched_node
-
# Return subject
#
# @return [Subject]
View
1  spec/integration/mutant/method_matching_spec.rb
@@ -8,6 +8,7 @@
end
before do
+ #eval(body, TOPLEVEL_BINDING, __FILE__, 0)
eval(body)
File.stub(:read => body)
end
View
25 spec/integration/mutant/rspec_killer_spec.rb
@@ -1,9 +1,6 @@
require 'spec_helper'
describe Mutant,'rspec integration' do
- before do
- pending
- end
around do |example|
Dir.chdir(TestApp.root) do
@@ -11,23 +8,13 @@
end
end
- specify 'allows to run rspec with mutations' do
-
- Mutant::Matcher::Method.parse('TestApp::Literal#string').each do |subject|
- subject.each do |mutation|
- runner = Mutant::Killer::Rspec.run(mutation)
- runner.fail?.should be(false)
- end
- subject.reset
- end
+ let(:strategy) { Mutant::Strategy::Rspec::DM2 }
- Mutant::Matcher::Method.parse('TestApp::Literal#uncovered_string').each do |subject|
- subject.each do |mutation|
- runner = Mutant::Killer::Rspec.run(mutation)
- runner.fail?.should be(true)
- end
- subject.reset
- end
+ specify 'allows to kill mutations' do
+ Kernel.system("bundle exec mutant -I lib -r test_app --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)
end
end
View
22 spec/support/rspec.rb
@@ -0,0 +1,22 @@
+# Patch rspec to allow nested execution
+module Rspec
+ # Run block in clean rspec environment
+ #
+ # @return [Object]
+ # returns the value of block
+ #
+ # @api private
+ #
+ def self.nest
+ original_world, original_configuration =
+ ::RSpec.instance_variable_get(:@world),
+ ::RSpec.instance_variable_get(:@configuration)
+
+ ::RSpec.reset
+
+ yield
+ ensure
+ ::RSpec.instance_variable_set(:@world, original_world)
+ ::RSpec.instance_variable_set(:@configuration, original_configuration)
+ end
+end
View
21 stuff.rb
@@ -1,21 +0,0 @@
-
- # Run block in clean rspec environment
- #
- # @return [Object]
- # returns the value of block
- #
- # @api private
- #
- def self.nest
- original_world, original_configuration =
- ::RSpec.instance_variable_get(:@world),
- ::RSpec.instance_variable_get(:@configuration)
-
- ::RSpec.reset
-
- yield
- ensure
- ::RSpec.instance_variable_set(:@world, original_world)
- ::RSpec.instance_variable_set(:@configuration, original_configuration)
- end
-
Please sign in to comment.
Something went wrong with that request. Please try again.