Replacing the paid button with the cancel/hide action block cut the old markup at the first <% end %>, which belonged to the button's inner if/else, leaving a stray </button></form><% end %> behind. show.erb no longer compiled and every admin invoice page returned 500; nothing rendered that page in tests. Remove the leftovers, render the page in every state (pending, paid, cancelled, hidden), and compile every view in a test so an unbalanced template fails CI even when no test visits that page. Assisted-by: Claude:opus-5
13 lines
534 B
Ruby
13 lines
534 B
Ruby
require_relative 'test_helper'
|
|
|
|
# A template with unbalanced <% end %> only fails when that page is
|
|
# rendered; compile every view up front so CI catches it regardless.
|
|
class TemplatesTest < Minitest::Test
|
|
Dir[File.join(__dir__, '..', 'views', '**', '*.erb')].each do |path|
|
|
name = path.sub(%r{.*/views/}, '').tr('/.', '__')
|
|
define_method("test_compiles_#{name}") do
|
|
tmpl = Tilt::ErubiTemplate.new(path, escape_html: true)
|
|
tmpl.send(:compiled_method, [], Object) # raises SyntaxError if broken
|
|
end
|
|
end
|
|
end
|