Skip to content

Commit

Permalink
Apply pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
kbrock committed May 15, 2015
1 parent 01720a7 commit 668c8bc
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 30 deletions.
3 changes: 3 additions & 0 deletions lib/mutant/integration.rb
Expand Up @@ -6,6 +6,9 @@ class Integration

REGISTRY = {}

ALL = Mutant::Expression.parse('*')
EXPRESSION_DELIMITER = ' '.freeze

# Setup integration
#
# @param [String] name
Expand Down
50 changes: 22 additions & 28 deletions lib/mutant/integration/minitest.rb
Expand Up @@ -13,31 +13,26 @@ class Integration
class Minitest < self
# represents the data associated with a test
class TestCase
attr_accessor :class_name
attr_accessor :test_method
include Concord.new(:class_name, :test_method)

def initialize(class_name, test_method)
@class_name = class_name
@test_method = test_method
end
attr_reader :class_name

def clazz
Object.const_get(class_name)
def run_passes?(reporter)
::Minitest::Runnable.run_one_method(klass, test_method, reporter)
reporter.passes?
end

def method_name
test_method[5..-1]
end

def runs_successfully?(reporter)
::Minitest::Runnable.run_one_method(clazz, test_method, reporter)
reporter.passes?
private

def klass
Mutant.constant_lookup(class_name)
end
end

ALL = Mutant::Expression.parse('*')
EXPRESSION_DELIMITER = ' '.freeze

register 'minitest'

def initialize
Expand All @@ -48,26 +43,15 @@ def initialize
def setup
$LOAD_PATH << 'test' unless $LOAD_PATH.include?('test')
$LOAD_PATH << 'lib' unless $LOAD_PATH.include?('lib')
Dir.glob('./test/**/*_test.rb').each { |f| require f }
Dir.glob('./test/**/test_*.rb').each { |f| require f }
end

# summary reporter detects failures
# progress reporter prints dots
# could include option verbose if desired
def make_reporter(output)
options = { io: output }
reporter = ::Minitest::CompositeReporter.new
reporter << ::Minitest::SummaryReporter.new(options[:io], options)
reporter << ::Minitest::ProgressReporter.new(options[:io], options)
reporter
Dir.glob('./test/**/*_test.rb').each(&method(:require))
Dir.glob('./test/**/test_*.rb').each(&method(:require))
end

def call(tests)
examples = tests.map(&all_tests_index.method(:fetch)).to_set
start = Time.now

examples.detect { |test| !test.runs_successfully?(@reporter) }
examples.each { |test| break unless test.run_passes?(@reporter) }

@output.rewind
Result::Test.new(
Expand Down Expand Up @@ -109,6 +93,16 @@ def all_examples
end
end
end

# summary reporter detects failures
# progress reporter prints dots
# could include option verbose if desired
def make_reporter(output)
reporter = ::Minitest::CompositeReporter.new
reporter << ::Minitest::SummaryReporter.new(output)
reporter << ::Minitest::ProgressReporter.new(output)
reporter
end
end
end
end
2 changes: 0 additions & 2 deletions lib/mutant/integration/rspec.rb
Expand Up @@ -5,8 +5,6 @@ class Integration
# Shared parts of rspec2/3 integration
class Rspec < self

ALL = Mutant::Expression.parse('*')
EXPRESSION_DELIMITER = ' '.freeze
LOCATION_DELIMITER = ':'.freeze
EXIT_SUCCESS = 0
CLI_OPTIONS = IceNine.deep_freeze(%w[spec --fail-fast])
Expand Down

0 comments on commit 668c8bc

Please sign in to comment.