Sha256: a8210f06ef3b3e31aa29148e51acf0261cdfbd424e5abe4588e22c6c47682869

Contents?: true

Size: 1.13 KB

Versions: 7

Compression:

Stored size: 1.13 KB

Contents

# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
#
# Fat Free CRM is freely distributable under the terms of MIT license.
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
module MockIMAP
  def mock_imap
    @imap = double
    @settings = @crawler.instance_variable_get("@settings")
    @settings[:address] = @mock_address
    Net::IMAP.stub(:new).with(@settings[:server], @settings[:port], @settings[:ssl]).and_return(@imap)
  end

  def mock_connect
    mock_imap
    @imap.stub(:login).and_return(true)
    @imap.stub(:select).and_return(true)
  end

  def mock_disconnect
    @imap.stub(:disconnected?).and_return(false)
    @imap.stub(:logout).and_return(true)
    @imap.stub(:disconnect).and_return(true)
  end

  def mock_message(body)
    @fetch_data = double
    @fetch_data.stub(:attr).and_return("RFC822" => body)
    @imap.stub(:uid_search).and_return([ :uid ])
    @imap.stub(:uid_fetch).and_return([ @fetch_data ])
    @imap.stub(:uid_copy).and_return(true)
    @imap.stub(:uid_store).and_return(true)
    body
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
fat_free_crm-0.13.6 spec/support/mail_processor_mocks.rb
fat_free_crm-0.13.5 spec/support/mail_processor_mocks.rb
fat_free_crm-0.13.4 spec/support/mail_processor_mocks.rb
fat_free_crm-0.13.3 spec/support/mail_processor_mocks.rb
fat_free_crm-0.13.2 spec/support/mail_processor_mocks.rb
fat_free_crm-0.13.1 spec/support/mail_processor_mocks.rb
fat_free_crm-0.13.0 spec/support/mail_processor_mocks.rb