Sha256: ff390d6e78d5bb6bc3478f5d4fefb2c5c81e5346528cac4876d87af47b795897
Contents?: true
Size: 1.11 KB
Versions: 3
Compression:
Stored size: 1.11 KB
Contents
# encoding: utf-8 require 'spec_helper' describe Email::Mboxrd::Message do let(:from) { 'me@example.com' } let(:date) { DateTime.new(2012, 12, 13, 18, 23, 45) } let(:message_body) do double('Body', :clone => cloned_message_body, :force_encoding => nil) end let(:cloned_message_body) { "Foo\nBar\nFrom at the beginning of the line\n>>From quoted" } subject { described_class.new(message_body) } context '#to_s' do let(:mail) { double('Mail', :from =>[from], :date => date) } before do allow(Mail).to receive(:new).with(cloned_message_body).and_return(mail) end it 'does not modify the message' do subject.to_s expect(message_body).to_not have_received(:force_encoding).with('binary') end it "adds a 'From ' line at the start" do expect(subject.to_s).to start_with('From ' + from + ' ' + date.asctime + "\n") end it "replaces existing 'From ' with '>From '" do expect(subject.to_s).to include("\n>From at the beginning") end it "appends > before '>+From '" do expect(subject.to_s).to include("\n>>>From quoted") end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
imap-backup-1.0.12 | spec/unit/email/mboxrd/message_spec.rb |
imap-backup-1.0.11 | spec/unit/email/mboxrd/message_spec.rb |
imap-backup-1.0.10 | spec/unit/email/mboxrd/message_spec.rb |