Skip to content

Instantly share code, notes, and snippets.

@colszowka
Last active December 18, 2015 19:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save colszowka/5830082 to your computer and use it in GitHub Desktop.
Save colszowka/5830082 to your computer and use it in GitHub Desktop.
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