Sha256: 59f9ea7a088c98d6f301d98ca8a0fda5cd4bc3b68358d6536ddbd8f9a2e2aa9b
Contents?: true
Size: 1.42 KB
Versions: 4
Compression:
Stored size: 1.42 KB
Contents
# encoding: utf-8 load File.expand_path('../../spec_helper.rb', File.dirname(__FILE__)) describe Imap::Backup::Account::Folder do context 'with instance' do before :each do @imap = stub('Net::IMAP') @connection = stub('Imap::Backup::Account::Connection', :imap => @imap) end subject { Imap::Backup::Account::Folder.new(@connection, 'my_folder') } context '#uids' do it 'should list available messages' do @imap.should_receive(:examine).with('my_folder') @imap.should_receive(:uid_search).with(['ALL']).and_return([5678, 123]) subject.uids.should == [123, 5678] end end context '#fetch' do before :each do @message_body = 'the body' @message = { 'RFC822' => @message_body, 'other' => 'xxx' } end it 'should request the message, the flags and the date' do @imap.should_receive(:examine).with('my_folder') @imap.should_receive(:uid_fetch). with([123], ['RFC822', 'FLAGS', 'INTERNALDATE']). and_return([[nil, @message]]) subject.fetch(123) end if RUBY_VERSION > '1.9' it 'should set the encoding on the message' do @imap.stub!(:examine => nil, :uid_fetch => [[nil, @message]]) @message_body.should_receive(:force_encoding).with('utf-8') subject.fetch(123) end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems