Fix trace tag interpolation, and add a test

This commit is contained in:
Andy Allan 2020-11-25 11:34:35 +00:00
parent f635b98b8c
commit b83c0acbd1
2 changed files with 12 additions and 1 deletions

View file

@ -1,7 +1,7 @@
<% trace_name = tag.strong(@trace_name) %> <% trace_name = tag.strong(@trace_name) %>
<% trace_description = tag.em(@trace_description) %> <% trace_description = tag.em(@trace_description) %>
<% if @trace_tags.length > 0 %> <% if @trace_tags.length > 0 %>
<% tags = @trace_tags.map { tag.tag.rstrip.join(" ") } %> <% tags = @trace_tags.map(&:tag).join(" ") %>
<%= t ".description_with_tags_html", :trace_name => trace_name, :trace_description => trace_description, :tags => tags %> <%= t ".description_with_tags_html", :trace_name => trace_name, :trace_description => trace_description, :tags => tags %>
<% else %> <% else %>
<%= t ".description_with_no_tags_html", :trace_name => trace_name, :trace_description => trace_description %> <%= t ".description_with_no_tags_html", :trace_name => trace_name, :trace_description => trace_description %>

View file

@ -6,4 +6,15 @@ class UserMailerTest < ActionMailer::TestCase
assert_match(/<html lang=/, email.html_part.body.to_s) assert_match(/<html lang=/, email.html_part.body.to_s)
end end
def test_gpx_description_tags
trace = create(:trace) do |t|
create(:tracetag, :trace => t, :tag => "one")
create(:tracetag, :trace => t, :tag => "two")
create(:tracetag, :trace => t, :tag => "three")
end
email = UserMailer.gpx_success(trace, 100)
assert_match(/one two three/, email.html_part.body.to_s)
end
end end