method
    
    assert_emails
 
  assert_emails(number, &block)
  public
  Asserts that the number of emails sent matches the given number.
def test_emails assert_emails 0 ContactMailer.welcome.deliver_now assert_emails 1 ContactMailer.welcome.deliver_now assert_emails 2 end
If a block is passed, that block should cause the specified number of emails to be sent.
def test_emails_again assert_emails 1 do ContactMailer.welcome.deliver_now end assert_emails 2 do ContactMailer.welcome.deliver_now ContactMailer.welcome.deliver_later end end
  
    
      Register or 
      log in
      to add new notes.
  
  
  
  
      
     thewinner -  
    May  6, 2011
 thewinner -  
    May  6, 2011 
    
  
  
  
       
  
  
  
           thewinner -  
    May  6, 2011
 thewinner -  
    May  6, 2011 
    
  
    
    0 thanks
     
  
  
  Asserting Emails
–setup_mailer.rb in config/initializers –rails g mailer MailerName –methods in mailer_name.rb –files in views/mailer_name –MailerName.method(@object).deliver in object controller

 RSpec
RSpec Ruby on Rails
Ruby on Rails Ruby
Ruby 
   
   
   
   
    
 = protected
 = protected
   
    