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 –