I have a slightly strange problem sending mail in test mode with Rails 3
My mail seems to be returning nothing. For example, I have a UserMailer mailer. Users can make changes that require approval in the application, so he has a method called changes_approved, which should send a message to the user with a notification that their changes have been approved .class
UserMailer < ActionMailer::Base
default :from => "from@example.com"
def changes_approved(user, page)
@user = user
@page = page
mail(:to => user.email, :subject => "Your changes have been approved")
end
end
In my controller, I have the following line
UserMailer.changes_approved(@page_revision.created_by, @page_revision.page).deliver
However, my tests fail with this error:
undefined `deliver 'method for nil: NilClass
tho (http://localhost: 3000 ), ,
, , , , , . , , ,
, , , , , .