Sha256: ce289da1deebffdfecb7f032d01dc4a8521ba6d33e76e709210cf1f03dadb653
Contents?: true
Size: 1.29 KB
Versions: 10
Compression:
Stored size: 1.29 KB
Contents
# frozen_string_literal: true # 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
10 entries across 10 versions & 1 rubygems