aboutsummaryrefslogtreecommitdiffstats
path: root/spec/lib/attachment_to_html/html_spec.rb
diff options
context:
space:
mode:
authorGareth Rees <gareth@mysociety.org>2014-03-17 11:15:40 +0000
committerGareth Rees <gareth@mysociety.org>2014-03-28 09:39:04 +0000
commitd57ca2a22579df4c634d554989c0ee9e4ebb5165 (patch)
treee1d11c626cedf57373be95b6b1ec6ce4dc22ea30 /spec/lib/attachment_to_html/html_spec.rb
parent0adf9399cbef42054809479c8f1b64dad7bbf8ca (diff)
Add AttachmentToHTML library
Extracts the attachment processing from FoiAttachment#body_to_html AttachmentToHTML contains adapters which convert - text/plain - application/pdf - application/rtf Results are returned as an AttachmentHTML::HTML instance which contains the raw HTML and other metadata about the conversion.
Diffstat (limited to 'spec/lib/attachment_to_html/html_spec.rb')
-rw-r--r--spec/lib/attachment_to_html/html_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/lib/attachment_to_html/html_spec.rb b/spec/lib/attachment_to_html/html_spec.rb
new file mode 100644
index 000000000..65b63d383
--- /dev/null
+++ b/spec/lib/attachment_to_html/html_spec.rb
@@ -0,0 +1,24 @@
+require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
+
+describe AttachmentToHTML::HTML do
+
+ let(:adapter) { OpenStruct.new(:to_html => '<p>hello</p>', :success? => true) }
+ let(:html) { AttachmentToHTML::HTML.new(adapter) }
+
+ describe :to_s do
+
+ it 'returns the raw html' do
+ html.to_s.should == '<p>hello</p>'
+ end
+
+ end
+
+ describe :success? do
+
+ it 'returns whether the conversion succeeded' do
+ html.success?.should be_true
+ end
+
+ end
+
+end