ruby on rails - How to check rspec code coverage -


i'm working on first simple rails app. , did homework should before else - rspec tests. delayed in purpose because of no experience wasn't sure , how rspec tests. have tests models , controllers , it's time me think how tests covers code.

then found rake stats, shows me that:

+----------------------+-------+-------+---------+---------+-----+-------+ | name                 | lines |   loc | classes | methods | m/c | loc/m | +----------------------+-------+-------+---------+---------+-----+-------+ | controllers          |   214 |   161 |       4 |      29 |   7 |     3 | | helpers              |    12 |    12 |       0 |       1 |   0 |    10 | | models               |    17 |    13 |       2 |       0 |   0 |     0 | | mailers              |     0 |     0 |       0 |       0 |   0 |     0 | | javascripts          |    29 |     3 |       0 |       1 |   0 |     1 | | libraries            |     0 |     0 |       0 |       0 |   0 |     0 | | helper specs         |    15 |     4 |       0 |       0 |   0 |     0 | | controller specs     |   170 |   137 |       0 |       0 |   0 |     0 | | model specs          |    78 |    65 |       0 |       0 |   0 |     0 | +----------------------+-------+-------+---------+---------+-----+-------+ | total                |   535 |   395 |       6 |      31 |   5 |    10 | +----------------------+-------+-------+---------+---------+-----+-------+   code loc: 189     test loc: 206     code test ratio: 1:1.1 

it shows how many classes , methods controllers , models have. i'm missing here how many tested. wish have instead of zeros there. @ same time nice know methods has no tests. there gem provides information or other way check ?

i'd recommend simplecov this.

here's nice starting configuration put in spec_helper.rb:

simplecov.start   add_filter '/test/'   add_filter '/config/'   add_filter '/vendor/'    add_group 'controllers', 'app/controllers'   add_group 'models', 'app/models'   add_group 'helpers', 'app/helpers'   add_group 'mailers', 'app/mailers' end # outputs report public folder simplecov.coverage_dir 'public/coverage' 

this makes ignore files in test, config , vendor folders , groups controllers, models, helpers , mailers under own tabs in html report.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

c# - Unity IoC Lifetime per HttpRequest for UserStore -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -