From: Andy Allan Date: Wed, 25 Nov 2020 11:34:35 +0000 (+0000) Subject: Fix trace tag interpolation, and add a test X-Git-Tag: live~2407^2 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/b83c0acbd11e155f9565309a2c4510f8eb35392a?ds=sidebyside Fix trace tag interpolation, and add a test --- diff --git a/app/views/user_mailer/_gpx_description.html.erb b/app/views/user_mailer/_gpx_description.html.erb index ac60ef7b9..50fcd6960 100644 --- a/app/views/user_mailer/_gpx_description.html.erb +++ b/app/views/user_mailer/_gpx_description.html.erb @@ -1,7 +1,7 @@ <% trace_name = tag.strong(@trace_name) %> <% trace_description = tag.em(@trace_description) %> <% 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 %> <% else %> <%= t ".description_with_no_tags_html", :trace_name => trace_name, :trace_description => trace_description %> diff --git a/test/mailers/user_mailer_test.rb b/test/mailers/user_mailer_test.rb index 23136951c..2a4b5a417 100644 --- a/test/mailers/user_mailer_test.rb +++ b/test/mailers/user_mailer_test.rb @@ -6,4 +6,15 @@ class UserMailerTest < ActionMailer::TestCase assert_match(/ 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