correctly greping for depreciated ERb block helpers
This commit is contained in:
parent
3015100b37
commit
56b03373a8
|
@ -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
|
||||
|
|
|
@ -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", "<b>blah blah blah</b><% @some_items.each do |item| %> <label>doo dah</label> <%= 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
|
||||
|
|
Loading…
Reference in New Issue