aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/attachment_to_html/adapters/rtf_spec.rb11
-rw-r--r--spec/models/incoming_message_spec.rb18
2 files changed, 29 insertions, 0 deletions
diff --git a/spec/lib/attachment_to_html/adapters/rtf_spec.rb b/spec/lib/attachment_to_html/adapters/rtf_spec.rb
index a3bf0e27e..2c53b5272 100644
--- a/spec/lib/attachment_to_html/adapters/rtf_spec.rb
+++ b/spec/lib/attachment_to_html/adapters/rtf_spec.rb
@@ -60,6 +60,17 @@ describe AttachmentToHTML::Adapters::RTF do
adapter.body.should_not include('//W3C//DTD HTML 4.01 Transitional//EN')
end
+ it 'converts empty files' do
+ attachment = FactoryGirl.build(:rtf_attachment, :body => load_file_fixture('empty.rtf'))
+ adapter = AttachmentToHTML::Adapters::RTF.new(attachment)
+ adapter.body.should == ''
+ end
+
+ it 'doesnt fail if the external command returns nil' do
+ AlaveteliExternalCommand.stub(:run).and_return(nil)
+ adapter.body.should == ''
+ end
+
end
diff --git a/spec/models/incoming_message_spec.rb b/spec/models/incoming_message_spec.rb
index f06dcbeeb..3b6887f76 100644
--- a/spec/models/incoming_message_spec.rb
+++ b/spec/models/incoming_message_spec.rb
@@ -112,6 +112,24 @@ describe IncomingMessage, 'when asked if a user can view it' do
end
+describe 'when destroying a message' do
+
+ before do
+ @incoming_message = FactoryGirl.create(:plain_incoming_message)
+ end
+
+ it 'can destroy a message with more than one info request event' do
+ @info_request = @incoming_message.info_request
+ @info_request.log_event('response',
+ :incoming_message_id => @incoming_message.id)
+ @info_request.log_event('edit_incoming',
+ :incoming_message_id => @incoming_message.id)
+ @incoming_message.fully_destroy
+ IncomingMessage.where(:id => @incoming_message.id).should be_empty
+ end
+
+end
+
describe 'when asked if it is indexed by search' do
before do