2012-05-15 13 views
5

वर्तमान में, मेरा स्थानीय विकास वातावरण वास्तविक ईमेल भेजने में सक्षम होने के लिए सेटअप है। इस वजह से, डिलीवरी की जा रही है, और ActionMailer::Base.deliveries तालिका में कुछ भी नहीं रखा गया है। क्या ककड़ी परीक्षण में ईमेल भेजने को अक्षम करना संभव है? यदि हां, तो ऐसा करने के लिए वाक्यविन्यास क्या है? या ईमेल भेजे जाने का परीक्षण करने का एक बेहतर तरीका है?क्या कार्रवाई पर ककड़ी परीक्षण हो रहा है जब एक्शनमेलर ईमेल बंद करना संभव है?

authentication_steps.rb:

Then /^I should receive a confirmation email$/ do 
    email = ActionMailer::Base.deliveries.last 
    email.subject.should == "Welcome to our website!" 
end 

एप्लिकेशन/config/development.rb

... 
    # Don't care if the mailer can't send 
    config.action_mailer.raise_delivery_errors = true 
    config.action_mailer.perform_deliveries = true 

    # Setup for local testing of emails using gmail test account 
    config.action_mailer.delivery_method = :smtp 
    config.action_mailer.smtp_settings = { :address => 'smtp.sendgrid.net', 
              :port => 587, 
              :domain => ENV['MAIL_DOMAIN'], 
              :authentication => 'plain', 
              :enable_starttls_auto => true, 
              :user_name => ENV['MAIL_USERNAME'], 
              :password => ENV['MAIL_PASSWORD'] 
              } 
    ... 

धन्यवाद

उत्तर

10
config.action_mailer.delivery_method = :test 

या

बस से पहले परीक्षण

012,
ActionMailer::Base.delivery_method = :test 
संबंधित मुद्दे

 संबंधित मुद्दे