gpt4 book ai didi

testing - 使用 Minitest 和身份验证进行功能测试

转载 作者:行者123 更新时间:2023-11-28 19:54:30 25 4
gpt4 key购买 nike

我正在尝试进行功能测试,但我不知道如何处理 cookie。我正在使用 Ruby 和 Minitest 对 Controller 进行功能测试。但是要在 Controller 中运行测试,首先我需要进行身份验证。身份验证使用 cookie 来查看用户是否已登录。问题是功能测试看不到 cookie 中的内容,所以我无法进行身份验证然后运行测试。有人给我提示来解决这个问题吗?

谢谢赫伯

最佳答案

我自己也在看同样的问题。作为这方面的新手,我不确定这是否有效,但我打算尝试使用 before do Hook 来运行身份验证。

类似的东西:

    before do
get :login
# fill in and submit
end

it "must do stuff" do
#Test things and hopefully it'll be logged in
end

关于testing - 使用 Minitest 和身份验证进行功能测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8230685/

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