diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2015-11-21 14:00:53 +0100 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2015-11-21 14:00:53 +0100 |
commit | 929e066051f00ec40c557c953dc174f052318773 (patch) | |
tree | e2f6346ce72ce3a6e99d7ac46c7349ed2974317f /spec/registration_spec.rb | |
parent | e02db5a74637c2c5b6f837011f1b1a103ed0d10e (diff) | |
download | norsk-urskog-registrations-929e066051f00ec40c557c953dc174f052318773.tar.gz norsk-urskog-registrations-929e066051f00ec40c557c953dc174f052318773.tar.bz2 norsk-urskog-registrations-929e066051f00ec40c557c953dc174f052318773.zip |
Sanitize filename of pdf file before creating it.
Diffstat (limited to 'spec/registration_spec.rb')
-rw-r--r-- | spec/registration_spec.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/spec/registration_spec.rb b/spec/registration_spec.rb index 522b155..4ccb24d 100644 --- a/spec/registration_spec.rb +++ b/spec/registration_spec.rb @@ -74,7 +74,7 @@ describe RegistrationApp do it "generates a PDF file" do expect(Prawn::Document).to have_received('new').with({ :page_size => "A4" }) - 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/) + expect(@doc_spy).to have_received('render_file').with(/uploads\/[0-9]{4}-[0-9]{2}-[0-9]{2}-#{sanitize(band_params['name'])}-#{sanitize(band_params['city'])}\.pdf/) end describe 'sends an email to Norsk Urskog' do @@ -87,7 +87,7 @@ describe RegistrationApp do 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/) + expect(message.body).to match(/example.org\/uploads\/[0-9]{4}-[0-9]{2}-[0-9]{2}-#{sanitize(band_params['name'])}-#{sanitize(band_params['city'])}\.pdf/) end end end |