markbates/cover_me

Fails to write coverage report when there is a space in the project path

Opened this issue · 4 comments

If you have a rails app in a path such as ~/Projects/My Project/myapp it appears that the cover_me gem is not able to create the coverage folder, and thus can't create the coverage report. There is no error at any point during the bundle install process or rails g cover_me:install process that would allude to this problem except for a non-fatal error at the end of a rake spec run.

The files /Users/chrisbloom7/Projects/My and /Users/chrisbloom7/Projects/My Project/myapp/Project/myapp/coverage/index.html do not exist.

Notice the how the first path in the error is truncated while the second path is duplicated.

FYI - I've tried forking your project and mucking with the tests to see if I could trigger an error (changing fake_project to fake\ project and/or the root folder to cover\ me), but all the tests still passed. I'm not sure if the existing tests test for the specific problem.

I think the problem is actually that it's trying to launch the files using the open command and they're not properly escaped. Check out line 37 of config.rb.

Look at the project in the console after you run rake. Do you see coverage.data and coverage/ ?

I'm experiencing the same problem on my machine - ruby 1.9.2 - I use Aptana Studio and the default workspace has several spaces in the path.

After I run "rake test" and I get this in the console:

The files /Users/danielrice/Documents/Aptana, /Users/danielrice/Documents/Aptana Studio 3 Workspace/fivepoint-star/Studio, /Users/danielrice/Documents/Aptana Studio 3 Workspace/fivepoint-star/3, and /Users/danielrice/Documents/Aptana Studio 3 Workspace/fivepoint-star/Workspace/fivepoint-star/coverage/index.html do not exist.

Any help is much appreciated. I'll take a look at line 37 of config.rb like you said. If I can fix it, I'll fork the project and help you out!

And for reference, here's my actual path:

/Users/danielrice/Documents/Aptana Studio 3 Workspace/fivepoint-star