Skip to content

Instantly share code, notes, and snippets.

@retr0h
Created March 16, 2009 18:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save retr0h/79988 to your computer and use it in GitHub Desktop.
Save retr0h/79988 to your computer and use it in GitHub Desktop.
namespace :spec do
desc "Report uncovered view templates."
task :missing_view_templates => :environment do
EXTENSION = ENV['extention'] || 'haml'
APP_VIEWS_DIR = File.join('app', 'views')
SPEC_VIEWS_DIR = File.join('spec', 'views')
Dir[File.join(Rails.root, "#{APP_VIEWS_DIR}/**/*.html.#{EXTENSION}")].each do |file|
file.match(%r{^#{File.join(Rails.root, APP_VIEWS_DIR)}/(.*)\.html.#{EXTENSION}$})
puts $1 unless File.exists?(File.join(Rails.root, SPEC_VIEWS_DIR, "#{$1}.html.#{EXTENSION}_spec.rb"))
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment