Created
November 16, 2012 22:20
-
-
Save mgauthier/4091418 to your computer and use it in GitHub Desktop.
Missing model and controller tests script
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
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