Created
September 9, 2010 19:20
-
-
Save ahawkins/572379 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[:models, :controllers, :views, :helpers, :lib, :mailers, :observers, :middleware].each do |sub| | |
desc "Run #{sub} specs with rcov" | |
Spec::Rake::SpecTask.new("rcov:#{sub}" => spec_prereq) do |t| | |
t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""] | |
t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"] | |
t.rcov = true | |
# create exclusion patterns since there no "inlucde only" option with rspec | |
directories = [:models, :controllers, :views, :helpers, :lib, :mailers, :observers, :middleware].reject {|dir| dir == sub} | |
patterns = directories.map {|dir| "\"#{dir}/*\""} | |
defaults = ['"spec/*"', '"gems/*"'] | |
excludes = "--exclude " + (patterns + defaults).join(',') | |
t.rcov_opts = [excludes, '--rails'] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment