spec/henkei_spec.rb in henkei-1.22.0 vs spec/henkei_spec.rb in henkei-1.23.0
- old
+ new
@@ -38,10 +38,20 @@
expect(mimetype.content_type).to(
eq 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
)
expect(mimetype.extensions).to include 'docx'
end
+
+ context 'when passing in the `pipe-error.png` test file' do
+ let(:data) { File.read 'spec/samples/pipe-error.png' }
+
+ it 'returns an empty result' do
+ text = Henkei.read :text, data
+
+ expect(text).to eq ''
+ end
+ end
end
describe '.new' do
it 'requires parameters' do
expect { Henkei.new }.to raise_error ArgumentError
@@ -126,9 +136,26 @@
expect(henkei.text).to include 'The quick brown fox jumped over the lazy cat.'
end
specify '#metadata reads metadata' do
expect(henkei.metadata['Content-Type']).to eq %w[application/vnd.apple.pages application/vnd.apple.pages]
+ end
+
+ context 'when passing in the `pipe-error.png` test file' do
+ let(:henkei) { Henkei.new 'spec/samples/pipe-error.png' }
+
+ it '#text returns an empty result' do
+ expect(henkei.text).to eq ''
+ end
+
+ it '#html returns an empty body' do
+ expect(henkei.html).to include '<body/>'
+ expect(henkei.html).to include '<meta name="tiff:ImageWidth" content="792"/>'
+ end
+
+ it '#mimetype returns an empty result' do
+ expect(henkei.mimetype.content_type).to eq 'image/png'
+ end
end
end
context 'initialized with a given URI' do
let(:henkei) { Henkei.new 'http://svn.apache.org/repos/asf/poi/trunk/test-data/document/sample.docx' }