Skip to content

colszowka/coverage-bug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Demo project for wrong results in Coverage library

Links

Running it

$ git clone https://github.com/colszowka/coverage-bug.git
$ cd coverage-bug
$ bundle
$ rake db:migrate

Now check out spec/requests/competitions_spec.rb:

When creating the record with factory_girl, the coverage is not reported as complete even though the code is run (you can verify that by adding a raise 'foo' inside the if-statement in app/models/competition.rb):

$ rake spec # using factory_girl
=> [1, 1, nil, 1, 1, nil, 1, 1, 0, 0, nil, nil, nil]
$ rake spec # using ActiveRecord.create
=> [1, 1, nil, 1, 1, nil, 1, 1, 1, 1, nil, nil, nil]

(Tested this on 1.9.2-p290 and 1.9.3-preview1, same (wrong) resuls on both)

About

Demonstration of bug in Ruby coverage

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published