Merge branch 'master' of git://github.com/tcopeland/rails_upgrade

* 'master' of git://github.com/tcopeland/rails_upgrade:
  Adding a test for 7a69f41
  grep with --exclude was resulting in hits on files with names like 'app/models/.svn/text-base/reading_list.rb.svn-base'.  Piping through an additional grep process seems a little wasteful, but it does the job for folks who have an app on Subversion.
This commit is contained in:
Ryan Bigg 2011-04-08 08:26:55 +10:00
commit 11d0804831
2 changed files with 8 additions and 2 deletions

View File

@ -378,9 +378,9 @@ module Rails
value = "" value = ""
# Specifically double quote for finding 'test_help' # Specifically double quote for finding 'test_help'
command = if double_quote command = if double_quote
"grep -r #{"-P" if perl_regex} --exclude=\*.svn\* \"#{text}\" #{where}" "grep -r #{"-P" if perl_regex} \"#{text}\" #{where} | grep -v \.svn"
else else
"grep -r #{"-P" if perl_regex} --exclude=\*.svn\* '#{text}' #{where}" "grep -r #{"-P" if perl_regex} '#{text}' #{where} | grep -v \.svn"
end end
Open3.popen3(command) do |stdin, stdout, stderr| Open3.popen3(command) do |stdin, stdout, stderr|

View File

@ -58,6 +58,12 @@ class ApplicationCheckerTest < ActiveSupport::TestCase
assert @checker.alerts.has_key?("Soon-to-be-deprecated ActiveRecord calls") assert @checker.alerts.has_key?("Soon-to-be-deprecated ActiveRecord calls")
end end
def test_check_svn_subdirs_are_not_included
make_file("app/models/.svn/text-base", "foo.rb.tmp", "Post.find(:all)")
@checker.check_ar_methods
assert @checker.alerts.empty?
end
def test_check_validation_on_methods def test_check_validation_on_methods
make_file("app/models", "post.rb", "validate_on_create :comments_valid?") make_file("app/models", "post.rb", "validate_on_create :comments_valid?")
@checker.check_validation_on_methods @checker.check_validation_on_methods