Sha256: 5eecb27f47ecbef066e299ea2ad3a43c7bf806074602ae3e220b78fc2017e6df

Contents?: true

Size: 1.25 KB

Versions: 24

Compression:

Stored size: 1.25 KB

Contents

require File.join(File.dirname(__FILE__), '..', '..', 'lib', 'flapjack', 'notifiers', 'mailer', 'init')
require File.join(File.dirname(__FILE__), '..', 'helpers')

describe "mailing notifier" do 

  it "should error if no from address is provided" do 
    lambda {
      mailer = Flapjack::Notifiers::Mailer.new(:log => MockLogger.new)
    }.should raise_error(ArgumentError, /from address/)
  end

  it "should error if no recipient is provided" do
    mailer = Flapjack::Notifiers::Mailer.new(:from_address => "test@example.org")
    lambda {
      mailer.notify()
    }.should raise_error(ArgumentError, /recipient/)
  end

  it "should error if no result is provided" do
    mailer = Flapjack::Notifiers::Mailer.new(:from_address => "test@example.org")
    lambda {
      mailer.notify(:who => 'foo')
    }.should raise_error(ArgumentError, /result/)
  end

  it "should deliver mail to a recipient" do 
    mailer = Flapjack::Notifiers::Mailer.new(:from_address => "test@example.org")
    response = mailer.notify(:who => OpenStruct.new(:email => "nobody@example.org"), 
                             :result => OpenStruct.new(:id => 11, :status => 2, :output => "foo"))
    response.status.should == '250'
  end

  it "should have a configurable server to send through"
end


Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
flapjack-0.6.23 spec.old/notifiers/mailer_spec.rb
flapjack-0.5.5 spec/notifiers/mailer_spec.rb
flapjack-0.5.4 spec/notifiers/mailer_spec.rb
flapjack-0.5.3 spec/notifiers/mailer_spec.rb