Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simple Coverage Route not showing up

I have a rails app that when I run my tests I am creating new files in my /cov folder

Finished in 20.6 seconds
19 examples, 0 failures
Coverage report generated for RSpec to /Users/nicholasshook/Sites/<<my project>>/coverage. 264 / 446 LOC (59.19%) covered.

Done.

However, when I try going to localhost/coverage/index.html I get this error

No route matches [GET] "/coverage/index.html"

Thanks

like image 437
shicholas Avatar asked Nov 25 '25 15:11

shicholas


1 Answers

If you're using SimpleCov or some similar gem to generate test results, those are static HTML files that are meant to be viewed locally on your machine. I.E. just browse to /Users/nicholasshook/Sites/<>/coverage/index.html and open that file in your browser.

Rails won't create routes to /coverage/index.html for security and manageability reasons. You can create a route to static html pages, but they must be in the /public directory. If you need your coverage results to be accessible in your app, you have a few options:

  1. Move your coverage file to the /public directory, and use a gem like High_Voltage https://github.com/thoughtbot/high_voltage to creat a route there
  2. You'll need to either reconfigure your coverage tool to put files in the /public directory, or manually copy them over
like image 89
theSteveMitchell Avatar answered Nov 27 '25 04:11

theSteveMitchell



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!