From f8474216b3c4aa9aad4db2b275fe7d26bd42d074 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sun, 1 Nov 2015 14:50:19 +0100 Subject: Include full url in sent email. --- spec/registration_spec.rb | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'spec') 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 -- cgit v1.2.3