Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added rake spec:cov for measuring coverage of tests, and rake spec:pr…

…of for profiling for the slowest tests

[finishes #15311503]
  • Loading branch information...
commit 3ae83140c7a81086c948703e991ca44c676d7df9 1 parent 085c12f
@adamjmurray authored
Showing with 17 additions and 3 deletions.
  1. +2 −0  .gitignore
  2. +13 −3 Rakefile
  3. +2 −0  spec/spec_coverage.rb
View
2  .gitignore
@@ -1,5 +1,7 @@
html
doc
+coverage
+coverage.data
.yardoc
.idea
*.iml
View
16 Rakefile
@@ -6,7 +6,7 @@ SUPPORTED_RUBIES = %w[ 1.8.7 1.9.2 jruby-1.5.6 jruby-1.6.3 ]
task :default => :spec
-CLEAN.include('html','doc') # clean and clobber do the same thing for now
+CLEAN.include('html','doc','coverage.data','coverage') # clean and clobber do the same thing for now
desc "Run RSpec tests with full output"
RSpec::Core::RakeTask.new do |spec|
@@ -28,12 +28,22 @@ end
namespace :spec do
- desc "Run RSpecs tests with summary output and fast failure"
+ desc "Run RSpec tests with summary output and fast failure"
RSpec::Core::RakeTask.new(:fast) do |spec|
spec.rspec_opts = ["--color", "--fail-fast"]
end
- desc "Run RSpecs tests on all supported versions of Ruby: #{SUPPORTED_RUBIES.join ', '}"
+ desc "Run RSpec tests and generate a coverage report"
+ RSpec::Core::RakeTask.new(:cov) do |spec|
+ spec.rspec_opts = ["--color", "-r", "#{File.dirname __FILE__}/spec/spec_coverage.rb"]
+ end
+
+ desc "Profile RSpec tests and report 10 slowest"
+ RSpec::Core::RakeTask.new(:prof) do |spec|
+ spec.rspec_opts = ["--color", "-p"]
+ end
+
+ desc "Run RSpec tests on all supported versions of Ruby: #{SUPPORTED_RUBIES.join ', '}"
task :all do
fail unless system("rvm #{SUPPORTED_RUBIES.join ','} rake -f #{__FILE__} spec:fast")
end
View
2  spec/spec_coverage.rb
@@ -0,0 +1,2 @@
+require 'cover_me'
+at_exit { CoverMe.complete! }

0 comments on commit 3ae8314

Please sign in to comment.
Something went wrong with that request. Please try again.