aboutsummaryrefslogtreecommitdiffstats
path: root/spec/factories
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2014-12-22 10:55:30 +0000
committerLouise Crow <louise.crow@gmail.com>2014-12-22 16:33:13 +0000
commit55f7ac2004f53ebc48efb90c45f64563a7cd660d (patch)
tree8a5e71cc0a4c03b4e9cf103a1fea688f07054860 /spec/factories
parentb6cd9b05ae27370088c04973413730040f4ff08c (diff)
Sanitize the contents of HTML attachments before display
Diffstat (limited to 'spec/factories')
-rw-r--r--spec/factories/foi_attchments.rb5
-rw-r--r--spec/factories/incoming_messages.rb8
2 files changed, 13 insertions, 0 deletions
diff --git a/spec/factories/foi_attchments.rb b/spec/factories/foi_attchments.rb
index 4e9875a00..a1d04ccf0 100644
--- a/spec/factories/foi_attchments.rb
+++ b/spec/factories/foi_attchments.rb
@@ -16,6 +16,11 @@ FactoryGirl.define do
filename 'interesting.rtf'
body { load_file_fixture('interesting.rtf') }
end
+ factory :html_attachment do
+ content_type 'text/html'
+ filename 'interesting.html'
+ body { load_file_fixture('interesting.html') }
+ end
end
end
diff --git a/spec/factories/incoming_messages.rb b/spec/factories/incoming_messages.rb
index 38ad98394..ec0afdcd0 100644
--- a/spec/factories/incoming_messages.rb
+++ b/spec/factories/incoming_messages.rb
@@ -23,6 +23,14 @@ FactoryGirl.define do
end
end
+ factory :incoming_message_with_html_attachment do
+ after_create do |incoming_message, evaluator|
+ FactoryGirl.create(:html_attachment,
+ :incoming_message => incoming_message,
+ :url_part_number => 2)
+ end
+ end
+
factory :incoming_message_with_attachments do
# foi_attachments_count is declared as an ignored attribute and available in
# attributes on the factory, as well as the callback via the evaluator