Cucumber 中的 http 基本身份验证测试
我正在尝试通过 http basic 测试登录,但不断收到错误,我已上传代码 这里
我有http_basic_authenticate_with name:“name”,password:“password”
在我的应用程序控制器中,
我的登录步骤定义是;
Given /^I login as admin$/ do
authorize "name", "password"
end
但它不起作用,我收到错误
expected there to be content "Posts" in "HTTP Basic: Access denied.\n"
(RSpec::Expectations::ExpectationNotMetError)
有人可以告诉我如何让黄瓜/水豚登录吗?
I'm trying to test logging in via http basic but am continually getting errors, I've uploaded the code here
I have http_basic_authenticate_with name: "name", password: "password"
in my application controller
My step definition for logging in is;
Given /^I login as admin$/ do
authorize "name", "password"
end
but it doesn't work and I get the error
expected there to be content "Posts" in "HTTP Basic: Access denied.\n"
(RSpec::Expectations::ExpectationNotMetError)
can someone tell me how to get cucumber/capybara to log in?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我让它使用两种不同方法之一;随意选择:
我的测试响应 browser_basic_authorize
或
我在搜索中的多个位置找到的两者。
I got it to work with one of two different approaches; take your pick:
My tests responded to browser_basic_authorize
or
both of which I found at several places in my search.
使用 selenium Web 驱动程序并通过 page.driver.visit("https://username:[电子邮件受保护]")
Use the selenium web driver and visit the website with page.driver.visit("https://username:[email protected]")