Browse Source

Add a subject when sending out.

tags/v0.1.0^2
Bèr Kessels 1 year ago
parent
commit
0de401483e
2 changed files with 4 additions and 1 deletions
  1. 3
    1
      lib/contact.rb
  2. 1
    0
      test/integration/create_message_test.rb

+ 3
- 1
lib/contact.rb View File

@@ -22,7 +22,9 @@ post '/messages' do
@email = params['email']
@message = params['message']

Pony.mail(reply_to: @email, body: erb(:mail_text))
Pony.mail(reply_to: @email,
subject: "[Contactform PlaceBazaar] #{@name}",
body: erb(:mail_text))
status 201
end


+ 1
- 0
test/integration/create_message_test.rb View File

@@ -17,6 +17,7 @@ describe 'add message through REST' do
assert_equal %w[webmaster@example.com], last_mail.to
assert_equal %w[contact@placebazaar.org], last_mail.from
assert_equal %w[harry@hogwards.edu.wizard], last_mail.reply_to
assert_equal '[Contactform PlaceBazaar] Harry Potter', last_mail.subject
assert_includes last_mail.body.to_s, 'Wingardium Leviosar'
assert_includes last_mail.body.to_s, 'name: Harry Potter'
assert_includes last_mail.body.to_s, 'email: harry@hogwards.edu.wizard'

Loading…
Cancel
Save