0
導軌用於指導測試郵件程序的示例代碼如下:Rails指南測試郵件程序的示例?
require 'test_helper'
class UserMailerTest < ActionMailer::TestCase
tests UserMailer
test "invite" do
# Send the email, then test that it got queued
email = UserMailer.create_invite('[email protected]',
'[email protected]', Time.now).deliver
assert !ActionMailer::Base.deliveries.empty?
# Test the body of the sent email contains what we expect it to
assert_equal ['[email protected]'], email.from
assert_equal ['[email protected]'], email.to
assert_equal 'You have been invited by [email protected]', email.subject
assert_equal read_fixture('invite').join, email.body.to_s
end
end
什麼是此行的目的和我必須將它添加在我的測試? - > 測試UserMailer
在這個非常特殊的話題的整個討論你是印度人? :-)我也是:-) –
@ArupRakshit不,我是墨西哥人。開玩笑。 :) –
哈哈:-)在某個時間後趕上你..愛印度在SO –