markbates / cover_me

An RCov-esque coverage tool for Ruby 1.9

Home Page:http://www.metabates.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't disable open command at exit

slbug opened this issue · comments

i have empty rails3 app with installed rspec2 and cover_me. in spec/spec_helper.rb i have lines

CoverMe.config do |c|
  c.at_exit = Proc.new {}
end

before RSpec.configure and after all requires. after running rake spec it still opens browser.

I have the same issue. The only way I managed to stop it was to put the CoverMe.config block in application.rb! Even putting it in environment/test.rb didn't work.

Okay putting it in lib/tasks/cover_me.rake works.

For what it's worth, I think it would be a better default to not open the coverage report in a browser.

Yeah, I was a bit surprised at that default too. Isn't "open url" a mac-only command too? At least it's easy to override...

I added the following to config.rb line ~37

if RUBY_PLATFORM.downcase.include?("linux")
xdg-open #{index}
else
`open #{index}end
end

Works for linux but this is not a 100% percent solution, details here: http://snippets.dzone.com/posts/show/6238

I have the same issue. Setting the default to not open the report would be better...

OK. The solution with putting it in the cover_me rake task worked for me, too.
Nothing else worked... not in spec_helper and not in an initializer...