-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doesn't play nice with Autotest #22
Comments
Yeah, the way cover_me is designed out-of-the-box (i.e. when installed the way the instructions say) to run every time specs are run can have bad interactions with other tools that also can wrap rspec, such as autotest. So I changed it so it doesn't wrap any default rspec tasks, and I created a separate "cover_me" task that runs cucumber and rspec both at once under cover_me, then launches the report. The benefit is no bad interactions. Everything works together well and plays nicely. This is the approach that autotest itself takes, it doesn't monkey with how you normally run rspec, it just provides a new way to call rspec that includes additional functionality. The drawback of course is that it doesn't automatically happen every time you run specs. The more steps you add, the less likely developers will run them all as often. So I guess, pick your poison? :) What I did is I removed this line: require 'cover_me' from the spec_helper.rb. It appears to me that this line initiates the beginning of collecting coverage information. Since we don't want coverage except in our new task, I removed it from there. And I removed these tasks from cover_me.rake: task :test do Rake::Task['cover_me:report'].invoke end task :spec do Rake::Task['cover_me:report'].invoke end Then I added this task instead to replace them: desc 'run cover_me coverage tests on specs and features' task :cover_me do require 'cover_me' Rake::Task['spec'].invoke Rake::Task['cucumber'].invoke Rake::Task['cover_me:report'].invoke end This task initiates coverage collecting with the require, then runs rspec and cucumber, then generates your report files and launches the report in a browser (which is the default thing the report task does). I am willing to refactor into a more general solution and submit a pull request, depending on what people really want, and what the cover_me author wants to accept... |
Using Ruby 1.9.2, Rails 3.0.3, running autotest 4.4.6, and autotest-rails 4.1.0, ZenTest 4.4.2, rspec 2.3.0, rspec-core 2.3.1, and rspec-rails 2.3.1 (also rspec-expections and rspec-mocks, but I don't think those matter in this issue).
Running autotest in the terminal works fine for my rspec tests. All will pass, however, the cover_me will only create a coverage.data file in my root, and not actually produce the coverage results folder.
I can't quite test if it works with a manual spec run because I haven't figured out how to run rspec by itself yet, but running the rake task for cover_me will indeed generate the reports.
Any ideas? I have included the require 'cover_me' in my spec_helper.
The text was updated successfully, but these errors were encountered: