我想测试我的用户邮件,我已经写了user_mailer_test.rb
像这样:令人困惑的错误
require 'test_helper'
class UserMailerTest < ActionMailer::TestCase
test "account_activation" do
user = users(:test)
user.activation_token = User.new_token
mail = UserMailer.account_activation(user)
assert_equal "Account activation", mail.subject
assert_equal [user.email], mail.to
assert_equal ["[email protected]"], mail.from
assert_match user.name, mail.body.encoded
assert_match user.activation_token, mail.body.encoded
assert_match CGI::escape(user.email), mail.body.encoded
end
end
当我运行我的测试套件,它抛出一个错误:
ERROR["test_account_activation", UserMailerTest, 2015-12-01 16:35:46 +0000]
test_account_activation#UserMailerTest (1448987746.26s)
SyntaxError: SyntaxError: (erb):36: syntax error, unexpected end-of-input, expecting keyword_end
...ut.force_encoding(__ENCODING__)
什么end
我是否缺少?测试看起来很适合我。提前致谢!
编辑:我只是跑我的整个测试套件,而不是邮件测试独自一人,他们是所有尽管他们都在一个小时前细跑了,我还没有最近编辑他们投掷unexpected end-of-input
。可能这是Cloud9的问题,而不是我的代码?
是不是您的邮件模板中的错误?它在错误中说'erb'。 –