Cucumber、rails 和会话变量
我正在实施两步登录。第一步,用户必须输入他的电子邮件+密码。如果正确,则会生成一个随机字符串,存储在会话中并发送到帐户持有人的移动电话。
我想知道如何从步骤定义中访问会话变量,或者如何以其他方式捕获随机字符串,以便我可以将其填充到表单中,并在用户使用它时测试整个登录。该字符串不存储在模型中,因为它只是临时的。
谢谢, 科林
I'm implementing a two step login. In the first step the user has to enter his email+password. If correct then a random string is generated, stored in the session and sent to the account holder's mobile phone.
I wonder how to access the session variable from within my step definitions or how to otherwise capture the random string so that I can use fill it in the form and so test the whole login as the user would use it. The string is not stored in the model because it's only temporary.
Thanks,
Corin
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
存根令牌生成器以返回固定字符串。
Stub the token generator to return a fixed string.
我通过对 SMSGateway 进行存根解决了这个问题。我在 features/env.rb 中的代码:
I solved it by stubbing the SMSGateway. My code in features/env.rb: