Bazı postalayıcıları rspec ile test etmeye çalışıyorum ancak teslimatlar her zaman boş.ActionMailer :: Base.deliveries her zaman Rspec içinde boş
Benim send_welcome_email fonksiyonu şöyle1) AccountMailer should send welcome email to account email
Failure/Error: ActionMailer::Base.deliveries.empty?.should be_false
expected true to be false
(bu benim model):
def send_welcome_email
AccountMailer.welcome self
end
Ve postasının:
require "spec_helper"
describe "AccountMailer", :type => :helper do
before(:each) do
ActionMailer::Base.delivery_method = :test
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.deliveries = []
end
it "should send welcome email to account email" do
account = FactoryGirl.create :account
account.send_welcome_email
ActionMailer::Base.deliveries.empty?.should be_false
ActionMailer::Base.deliveries.last.to.should == account.email
end
end
Bu başarısız: İşte benim RSpec testtir
class AccountMailer < ActionMailer::Base
default from: APP_CONFIG['email']['from']
def welcome data
if data.locale == 'es'
template = 'welcome-es'
else
template = 'welcome-en'
end
mail(:to => data.email, :subject => I18n.t('welcome_email_subject'), :template_name => template)
end
end
Herhangi bir fikir? Nasıl devam edeceğime emin değilim.
gibi daha fazla görünmesini beklerim. Bunun için teşekkürler! – MilesStanfield