lib/coverband/base.rb in coverband-0.1.0.preRC3 vs lib/coverband/base.rb in coverband-0.1.0.preRC4
- old
+ new
@@ -42,11 +42,11 @@
@ignore_patterns = Coverband.configuration.ignore
@sample_percentage = Coverband.configuration.percentage
@reporter = Coverband::RedisStore.new(Coverband.configuration.redis) if Coverband.configuration.redis
@stats = Coverband.configuration.stats
@verbose = Coverband.configuration.verbose
- @logger = Coverband.configuration.logger || Logger.new(STDOUT)
+ @logger = Coverband.configuration.logger
self
end
def configure_sampling
if @startup_delay!=0 || (rand * 100.0) > @sample_percentage
@@ -135,9 +135,19 @@
add_file_without_checks(file, line)
end
end
def add_file_without_checks(file, line)
+ # file from ruby coverband at this method call is a full path
+ # file from native coverband is also a full path
+ #
+ # at the moment the full paths don't merge so the 'last' one wins and each deploy
+ # with a normal capistrano setup resets coverage.
+ #
+ # should we make it relative in this method (slows down collection)
+ # -- OR --
+ # we could have the reporter MERGE the results after normalizing the filenames
+ # (went with this route see report_scov previous_line_hash)
if @verbose
@file_usage[file] += 1
@file_line_usage[file] = Hash.new(0) unless @file_line_usage.include?(file)
@file_line_usage[file][line] += 1
end