summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2015-11-01 14:50:19 +0100
committerHarald Eilertsen <haraldei@anduin.net>2015-11-01 14:50:19 +0100
commitf8474216b3c4aa9aad4db2b275fe7d26bd42d074 (patch)
tree3aeaa34411fb4a7f2064f50b1eb93f72e6e198f9
parentef9996515099b8aa04df83080404dcff8badd85c (diff)
downloadnorsk-urskog-registrations-f8474216b3c4aa9aad4db2b275fe7d26bd42d074.tar.gz
norsk-urskog-registrations-f8474216b3c4aa9aad4db2b275fe7d26bd42d074.tar.bz2
norsk-urskog-registrations-f8474216b3c4aa9aad4db2b275fe7d26bd42d074.zip
Include full url in sent email.
-rw-r--r--registration.rb4
-rw-r--r--spec/registration_spec.rb17
2 files changed, 14 insertions, 7 deletions
diff --git a/registration.rb b/registration.rb
index fe0ce40..2801a64 100644
--- a/registration.rb
+++ b/registration.rb
@@ -21,9 +21,9 @@ class RegistrationApp < Sinatra::Base
if request.form_data?
@band = Band.new(request['band'])
if @band.valid?
- pdf_file = File.join("uploads", create_pdf_file_name(@band))
+ pdf_file = File.join("/uploads", create_pdf_file_name(@band))
generate_pdf_for(@band, File.join(settings.public_folder, pdf_file))
- send_registration_emails_for(@band, url_for(pdf_file))
+ send_registration_emails_for(@band, url_for(pdf_file, :full))
erb :submitted
else
erb :index
diff --git a/spec/registration_spec.rb b/spec/registration_spec.rb
index 9bbf477..3111ebc 100644
--- a/spec/registration_spec.rb
+++ b/spec/registration_spec.rb
@@ -71,11 +71,18 @@ describe RegistrationApp do
expect(@doc_spy).to have_received('render_file').with(/uploads\/[0-9]{4}-[0-9]{2}-[0-9]{2}-#{band_params['name']}-#{band_params['city']}\.pdf/)
end
- it 'sends an email to Norsk Urskog' do
- message = Mail::TestMailer.deliveries.first
- expect(Mail::TestMailer.deliveries).not_to be_empty
- expect(message.to).to include('haraldei@anduin.net')
- expect(message.subject).to match(/Registrering av band #{band_params['name']} til Norsk Urskog/)
+ describe 'sends an email to Norsk Urskog' do
+ let(:message) { Mail::TestMailer.deliveries.first }
+
+ it 'sends an email to Norsk Urskog' do
+ expect(Mail::TestMailer.deliveries).not_to be_empty
+ expect(message.to).to include('haraldei@anduin.net')
+ expect(message.subject).to match(/Registrering av band #{band_params['name']} til Norsk Urskog/)
+ end
+
+ it 'contains the url to the pdf file' do
+ expect(message.body).to match(/example.org\/uploads\/[0-9]{4}-[0-9]{2}-[0-9]{2}-#{band_params['name']}-#{band_params['city']}\.pdf/)
+ end
end
end