Skip to content

Commit

Permalink
Trying to get the tests working in 1.9...
Browse files Browse the repository at this point in the history
  • Loading branch information
carlhoerberg committed Jun 1, 2011
1 parent 9c608f9 commit df0baec
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions test/spec_rack_mailexceptions.rb
Expand Up @@ -2,10 +2,8 @@
require 'rack/mock'

begin
require 'tmail'
require 'rack/contrib/mailexceptions'

require File.dirname(__FILE__) + '/mail_settings.rb'
require './lib/rack/contrib/mailexceptions'
require './test/mail_settings.rb'

class TestError < RuntimeError
end
Expand Down Expand Up @@ -57,13 +55,13 @@ def test_exception
mail.smtp @smtp_settings
end

tmail = mailer.send(:generate_mail, test_exception, @env)
tmail.to.should.equal ['foo@example.org']
tmail.from.should.equal ['bar@example.org']
tmail.subject.should.equal '[ERROR] Suffering Succotash!'
tmail.body.should.not.be.nil
tmail.body.should.be =~ /FOO:\s+"BAR"/
tmail.body.should.be =~ /^\s*THE BODY\s*$/
mail = mailer.send(:generate_mail, test_exception, @env)
mail.to.should.equal ['foo@example.org']
mail.from.should.equal ['bar@example.org']
mail.subject.should.equal '[ERROR] Suffering Succotash!'
mail.body.should.not.be.nil
mail.body.should.be =~ /FOO:\s+"BAR"/
mail.body.should.be =~ /^\s*THE BODY\s*$/
end

specify 'catches exceptions raised from app, sends mail, and re-raises' do
Expand Down Expand Up @@ -167,5 +165,5 @@ def self.tls; @@_tls; end
end
end
rescue LoadError => boom
STDERR.puts "WARN: Skipping Rack::MailExceptions tests (tmail not installed)"
STDERR.puts "WARN: Skipping Rack::MailExceptions tests (mail not installed)"
end

0 comments on commit df0baec

Please sign in to comment.