Sha256: 6ddefa6d266eecae527ab21857a6975f40e5f9d13de484978f33c3fb47596fef

Contents?: true

Size: 986 Bytes

Versions: 5

Compression:

Stored size: 986 Bytes

Contents

require 'spec_helper'

describe Safely::Strategy::Mail do
  describe "configuration" do
    %w( recipient sender subject_prefix ).each do |attr|
      it "should support configuring #{attr}" do
        Safely::Strategy::Mail.should respond_to( attr )
        Safely::Strategy::Mail.should respond_to( "#{attr}=" )
      end
    end
  end

  describe "reporting" do
    it "should be enabled when configured" do
      Safely::Strategy::Mail.recipient = "kenneth.kalmer@gmail.com"

      safely do
        raise "Argh"
      end

      Mail::TestMailer.deliveries.should_not be_empty

      mail = Mail::TestMailer.deliveries.last

      mail.to_addrs.should include("kenneth.kalmer@gmail.com")
      mail.body.should match(/Backtrace/)
    end

    it "should not bother if not configured" do
      Safely::Strategy::Mail.recipient = nil

      expect {
        safely do
          raise "Argh"
        end
      }.to_not change( Mail::TestMailer.deliveries, :length )
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
safely-0.3.2 spec/strategies/mail_spec.rb
safely-0.3.1 spec/strategies/mail_spec.rb
safely-0.3.0 spec/strategies/mail_spec.rb
safely-0.2.0 spec/strategies/mail_spec.rb
safely-0.1.0 spec/strategies/mail_spec.rb