Skip to content

Instantly share code, notes, and snippets.

@colszowka
Last active Dec 18, 2015
Embed
What would you like to do?
Quick demo of the problem of resetting Ruby STDLIB's Coverage mid-way
# On "ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-linux]", but should be the same on all 1.9+
require 'coverage'
Coverage.start
require './foo'
puts Coverage.result
# {"foo.rb"=>[1, 1, 0, nil, nil, 1, 0, nil, nil]}
Coverage.start
Foo.new.bar
puts Coverage.result
# {"foo.rb"=>[]}
class Foo
def bar
:bar
end
def baz
:baz
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment