Sha256: fe321a3f8e2da26d1a4d15c10c82083de61d5eefc7bf33c2e69e2bfcee4670c7

Contents?: true

Size: 1.26 KB

Versions: 15

Compression:

Stored size: 1.26 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
    allow(Net::IMAP).to receive(:new).with(@settings[:server], @settings[:port], @settings[:ssl]).and_return(@imap)
  end

  def mock_connect
    mock_imap
    allow(@imap).to receive(:login).and_return(true)
    allow(@imap).to receive(:select).and_return(true)
  end

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

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

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
fat_free_crm-0.14.2 spec/support/mail_processor_mocks.rb
fat_free_crm-0.15.2 spec/support/mail_processor_mocks.rb
fat_free_crm-0.16.4 spec/support/mail_processor_mocks.rb
fat_free_crm-0.14.1 spec/support/mail_processor_mocks.rb
fat_free_crm-0.15.1 spec/support/mail_processor_mocks.rb
fat_free_crm-0.16.3 spec/support/mail_processor_mocks.rb
fat_free_crm-0.16.2 spec/support/mail_processor_mocks.rb
fat_free_crm-0.16.1 spec/support/mail_processor_mocks.rb
fat_free_crm-0.16.0 spec/support/mail_processor_mocks.rb
fat_free_crm-0.15.0 spec/support/mail_processor_mocks.rb
fat_free_crm-0.15.0.beta.2 spec/support/mail_processor_mocks.rb
fat_free_crm-0.15.0.beta spec/support/mail_processor_mocks.rb
fat_free_crm-0.14.0 spec/support/mail_processor_mocks.rb
reduced_fat_crm-0.15.0.beta spec/support/mail_processor_mocks.rb
reduced_fat_crm-0.14.0 spec/support/mail_processor_mocks.rb