Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #7571: return_path_test.diff

File return_path_test.diff, 1.1 kB (added by joost, 2 years ago)
  • mail_service_test.rb

    old new  
    236236    body         "testing" 
    237237  end 
    238238 
     239  def return_path 
     240    recipients   "no.one@nowhere.test" 
     241    subject      "return path test" 
     242    from         "some.one@somewhere.test" 
     243    body         "testing" 
     244    headers      "return-path" => "another@somewhere.test" 
     245  end 
     246 
    239247  class <<self 
    240248    attr_accessor :received_body 
    241249  end 
     
    810818    assert_match %r{format=flowed}, mail['content-type'].to_s 
    811819    assert_match %r{charset=utf-8}, mail['content-type'].to_s 
    812820  end 
     821 
     822  def test_return_path_with_create 
     823    mail = TestMailer.create_return_path 
     824    assert_equal "<another@somewhere.test>", mail['return-path'].to_s 
     825  end 
     826 
     827  def test_return_path_with_deliver 
     828    ActionMailer::Base.delivery_method = :smtp 
     829    TestMailer.deliver_return_path 
     830    assert_match %r{^Return-Path: <another@somewhere.test>}, MockSMTP.deliveries[0][0] 
     831  end 
    813832end 
    814833 
    815834end # uses_mocha