From 3f23471e6507f1da77e0b588f005ebcdeda0350d Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Tue, 7 May 2013 10:07:09 +0100 Subject: Bugfix for the case where a suspended user sends a contact message. Their name (with the '(account suspended)' suffix) is marked by the translation call as HTML safe, so escapes the angled brackets when they are appended to it in the contact mailer code. Use string interpolation instead. --- spec/models/contact_mailer_spec.rb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'spec/models') diff --git a/spec/models/contact_mailer_spec.rb b/spec/models/contact_mailer_spec.rb index 202e45758..3af55ad77 100644 --- a/spec/models/contact_mailer_spec.rb +++ b/spec/models/contact_mailer_spec.rb @@ -1,8 +1,22 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') -describe ContactMailer, " when blah" do +describe ContactMailer, "when sending mail with a SafeBuffer name param (as when a suspended user + sends a message)" do before do + + end + + it 'should set a "from" address correctly' do + mail = ContactMailer.create_to_admin_message('test (account suspended)'.html_safe, + 'test@example.com', + 'Test subject', + 'Test message', + mock_model(User, :url_name => 'test_user'), + mock_model(InfoRequest, :url_title => 'test_request'), + mock_model(PublicBody, :url_name => 'test_public_body')) + mail.from.should_not be_nil end + end -- cgit v1.2.3