【问题标题】:Cucumber (with watir-webdriver): undefined method `confirmation_token'Cucumber (with watir-webdriver): 未定义的方法`confirmation_token'
【发布时间】:2012-07-05 21:26:16
【问题描述】:

如何在黄瓜中使用确认令牌?我需要这个来测试注册而不检查电子邮件。

我的代码:

  @b.text_field(:name => 'profile[prename]').set 'Kurt'

  @b.text_field(:name => 'profile[surname]').set 'Russell'

  @b.text_field(:id => 'profile_email').set 'user@trash-mail.com'

  @b.text_field(:id => 'profile_password').set 'password'

  @b.text_field(:name => 'profile[password_confirmation]').set 'password'

  @b.button(:id => 'profile_submit').click

  @ctoken = Profile.last.confirmation_token

  @b.goto("http://localhost:3000/profiles/confirmation?confirmation_token=#{@ctoken}")

或:

  @b.goto("http://localhost:3000/profiles/confirmation?confirmation_token=#{Profile.last.confirmation_token}")

我变成:nil:NilClass (NoMethodError) 的未定义方法`confirmation_token'

【问题讨论】:

    标签: email cucumber watir-webdriver confirmation specifications


    【解决方案1】:

    在我看来Profile.last 在您的情况下返回nil,因此错误消息undefined method confirmation_token for nil:NilClass (NoMethodError)。请分享您定义Profile的代码。

    【讨论】:

    • 我怎样才能找到这个确认令牌路径?
    • 我不知道那是什么。 Profile 是什么?它是如何定义的?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-02
    • 2017-03-25
    相关资源
    最近更新 更多