Sha256: 00489fe35787bf467f0d96e70bdfbded0582ca7e80d0af4a2e7e5ac0d13020e3

Contents?: true

Size: 981 Bytes

Versions: 1

Compression:

Stored size: 981 Bytes

Contents

require 'spec_helper'
require 'resque'

describe CheetahMail::ResqueMessenger do
  before do
    @options = {
      :host             => "foo.com",
      :username         => "foo_user",
      :password         => "foo",
      :aid              => "123",
      :whitelist_filter => /@test\.com$/,
      :enable_tracking  => false,
    }
    @messenger = CheetahMail::ResqueMessenger.new(@options)
    @message   = Message.new("/",{})
  end

  describe '#do_send' do
    it 'should queue up a job in resque' do
      Resque.should_receive(:enqueue).with(CheetahMail::ResqueMessenger, @message, @options)
      @messenger.do_send(@message)
    end
  end

  describe '.perform' do
    it 'should immediately send a message to cheetah' do
      CheetahMail::Messenger.should_receive(:new).with(@options).and_return(messenger = mock(:messenger))
      messenger.should_receive(:do_request).with(@message)
      CheetahMail::ResqueMessenger.perform(@message, @options)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cheetah_mail-0.6.0 spec/resque_messenger_spec.rb