gpt4 book ai didi

ruby-on-rails - 期望输入结束的语法错误

转载 作者:数据小太阳 更新时间:2023-10-29 07:55:20 24 4
gpt4 key购买 nike

嗨,我一直收到这条消息,但我没有发现任何问题,有人可以帮助我吗?这是我的代码

ERROR["test_account_activation", UserMailerTest, 0.5950376749970019]
test_account_activation#UserMailerTest (0.60s)
SyntaxError: SyntaxError: /home/ubuntu/workspace/sample_app/app/mailers/user_mailer.rb:23: syntax error, unexpected keyword_end, expecting end-of-input
test/mailers/user_mailer_test.rb:6:in `block in <class:UserMailerTest>'

ERROR["test_password_reset", UserMailerTest, 0.6068314979784191]
test_password_reset#UserMailerTest (0.61s)
SyntaxError: SyntaxError: /home/ubuntu/workspace/sample_app/app/mailers/user_mailer.rb:23: syntax error, unexpected keyword_end, expecting end-of-input
test/mailers/user_mailer_test.rb:17:in `block in <class:UserMailerTest>'

user_mailer_test.rb

require 'test_helper'
class UserMailerTest < ActionMailer::TestCase
test "account_activation" do
user = users(:michael)
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 ["noreply@example.com"], 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
test "password_reset" do
user = users(:michael)
user.reset_token = User.new_token
mail = UserMailer.password_reset(user)
assert_equal "Password reset", mail.subject
assert_equal [user.email], mail.to
assert_equal ["noreply@example.com"], mail.from
assert_match user.reset_token, mail.body.encoded
assert_match CGI::escape(user.email), mail.body.encoded
end
end

如果认为一切正常,我没有看到问题!谢谢 :)

最佳答案

根据错误消息,语法错误在 app/mailers/user_mailer.rb 文件的第 1 行。 23. 它不在 user_mailer_test.rb 文件中。

仔细查看错误信息,修复user_mailer.rb文件中的语法错误。

关于ruby-on-rails - 期望输入结束的语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34553749/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com