summaryrefslogtreecommitdiffstats
path: root/spec/pdf_form_spec.rb
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2015-11-21 14:00:53 +0100
committerHarald Eilertsen <haraldei@anduin.net>2015-11-21 14:00:53 +0100
commit929e066051f00ec40c557c953dc174f052318773 (patch)
treee2f6346ce72ce3a6e99d7ac46c7349ed2974317f /spec/pdf_form_spec.rb
parente02db5a74637c2c5b6f837011f1b1a103ed0d10e (diff)
downloadnorsk-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/pdf_form_spec.rb')
-rw-r--r--spec/pdf_form_spec.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/pdf_form_spec.rb b/spec/pdf_form_spec.rb
new file mode 100644
index 0000000..334678a
--- /dev/null
+++ b/spec/pdf_form_spec.rb
@@ -0,0 +1,19 @@
+require "spec_helper"
+
+describe "create_pdf_file_name" do
+ describe "returns a filename that" do
+ let(:band) { Struct.new(:name, :city).new("A: blöddy/band, name!", "Øksendal, Flünsbørg") }
+
+ before :each do
+ @filename = create_pdf_file_name(band)
+ end
+
+ it "contains no spaces" do
+ expect(@filename).not_to match(/[ ]+/)
+ end
+
+ it "contains no symbols" do
+ expect(@filename.gsub('.pdf', '')).not_to match(/[,.:!^'*\/\\]+/)
+ end
+ end
+end