Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 47fdaf695b
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 28 lines (22 sloc) 0.937 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
require File.dirname(__FILE__) + '/test_helper'

require 'cerberus/publisher/mail'
require 'cerberus/manager'
require 'mock/manager'

class MailPublisherTest < Test::Unit::TestCase
  def setup
    ActionMailer::Base.deliveries.clear
  end

  def test_publisher
    options = Cerberus::Config.new(nil, :publisher => {
       :mail => {:recipients => 'anatol.pomozov@hello.com', :sender => "cerberus@example.com", :delivery_method => 'test'},
       :extra_subject => "[#deployment]"},
       :application_name => 'MyApp')
    build = DummyManager.new('last message', 'this is output', 1232, 'anatol')

    Cerberus::Publisher::Mail.publish(build_status(true), build, options)

    mails = ActionMailer::Base.deliveries
    assert_equal 1, mails.size
    mail = mails[0]
    assert_equal 'cerberus@example.com', mail.from_addrs[0].address
    assert_equal '[MyApp][#deployment] Cerberus set up for project (1232)', mail.subject
  end
end
Something went wrong with that request. Please try again.