diff --git a/lib/application_checker.rb b/lib/application_checker.rb index f718994..8f3334a 100644 --- a/lib/application_checker.rb +++ b/lib/application_checker.rb @@ -259,7 +259,14 @@ module Rails # Checks for old-style ERb helpers def check_old_helpers - lines = grep_for("<% .* do.*%>", "app/views/**/*") + + lines = grep_for("<% .*content_tag.* do.*%>", "app/views/**/*") + lines += grep_for("<% .*javascript_tag.* do.*%>", "app/views/**/*") + lines += grep_for("<% .*form_for.* do.*%>", "app/views/**/*") + lines += grep_for("<% .*form_tag.* do.*%>", "app/views/**/*") + lines += grep_for("<% .*fields_for.* do.*%>", "app/views/**/*") + lines += grep_for("<% .*field_set_tag.* do.*%>", "app/views/**/*") + files = extract_filenames(lines) if files diff --git a/test/application_checker_test.rb b/test/application_checker_test.rb index 8768bbb..a5edd4d 100644 --- a/test/application_checker_test.rb +++ b/test/application_checker_test.rb @@ -244,6 +244,14 @@ class ApplicationCheckerTest < ActiveSupport::TestCase @checker.check_old_helpers assert @checker.alerts.has_key?("Deprecated ERb helper calls") + + end + + def test_check_old_helpers_lets_regular_blocks_pass + make_file("app/views/users/", "another_test.html.erb", "blah blah blah<% @some_items.each do |item| %> <%= item %> <% end %>") + @checker.check_old_helpers + + assert_equal @checker.alerts.has_key?("Deprecated ERb helper calls"), false end def test_check_old_helpers_lets_regular_blocks_pass