Skip to content

Commit

Permalink
added rake spec:cov for measuring coverage of tests, and rake spec:pr…
Browse files Browse the repository at this point in the history
…of for profiling for the slowest tests

[finishes #15311503]
  • Loading branch information
adamjmurray committed Jul 13, 2011
1 parent 085c12f commit 3ae8314
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -1,5 +1,7 @@
html
doc
coverage
coverage.data
.yardoc
.idea
*.iml
Expand Down
16 changes: 13 additions & 3 deletions Rakefile
Expand Up @@ -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|
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions 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.