gpt4 book ai didi

ruby-on-rails - Capybara::ExpectationNotMet,链接不合适

转载 作者:行者123 更新时间:2023-11-28 21:31:27 25 4
gpt4 key购买 nike

我已经为我的 Rails 3 应用程序进行了 Rspec/Capybara 测试。

其中一个测试开始失败:

it { should have_link(I18n.t('ui.delete'), href: user_path(User.last)) } 

这是一个输出错误:

1) User pages index delete links as an admin user 
Failure/Error: it { should have_link(I18n.t('ui.delete'), href: user_path(User.last)) }
Capybara::ExpectationNotMet:
expected to find link "o'chirish (delete)" but there were no matches.
Also found "o'chirish (delete)", "o'chirish (delete)",
"o'chirish (delete)", "o'chirish (delete)", "o'chirish (delete)", "o'chirish (delete)",
"o'chirish (delete)", "o'chirish (delete)",
which matched the selector but not all filters.
# ./spec/requests/user_pages_spec.rb:158:in `block (5 levels) in <top (required)>'

在我的网页上,链接看起来没问题(每个 o'chirish(删除) 都有一个删除链接)

1 admin admin admin@gmail.com | admin  
6 author author author@gmail.com | author | o'chirish (delete)
5 editorxxx editor editor@gmail.com | editor | o'chirish (delete)
9 home page user1@gmail.com | o'chirish (delete)
10 taken tekken user22@gmail.com | o'chirish (delete)
8 tester tester2 tester@gmail.com | o'chirish (delete)
7 user user user@gmail.com | o'chirish (delete)

非常感谢您的任何想法!

最佳答案

据我所知,我在两种情况下看到了该消息:链接存在,但不可见(display:none;)或者 href 不是相同的。既然你说你可以看到链接,你应该检查 href 是否设置正确。

关于ruby-on-rails - Capybara::ExpectationNotMet,链接不合适,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20537608/

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