Skip to content

Instantly share code, notes, and snippets.

@mgauthier
Created November 16, 2012 22:20
Show Gist options
  • Save mgauthier/4091418 to your computer and use it in GitHub Desktop.
Save mgauthier/4091418 to your computer and use it in GitHub Desktop.
Missing model and controller tests script
type = ARGV[0]
types = ["model", "controller"]
def strip_down_filename(f,token)
f.split("/").last.gsub("#{token}.rb","")
end
if !type || !types.include?(type)
puts "Usage: 'ruby missing_tests.rb [ model|controller ]'"
else
tests = Dir.glob("test/#{type}s/**/*.rb").map { |f| strip_down_filename(f, "_test") }
items = Dir.glob("app/#{type}s/**/*.rb").map { |f| strip_down_filename(f, "") }
(items - tests).each { |m| puts m }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment