【问题标题】:Cucumber rails test result黄瓜条测试结果
【发布时间】:2015-10-15 04:34:24
【问题描述】:

我在铁轨上学习黄瓜/水豚。我正在处理一个希望显示表中排序数据的场景。我无法弄清楚这条消息:

pending # 用你希望的代码表达上面的正则表达式

我有这张桌子:

  | title                   | rating | release_date |
  | Aladdin                 | G      | 25-Nov-1992  |
  | The Terminator          | R      | 26-Oct-1984  |
  | When Harry Met Sally    | R      | 21-Jul-1989  |
  | The Help                | PG-13  | 10-Aug-2011  |
  | Chocolat                | PG-13  | 5-Jan-2001   |
  | Amelie                  | R      | 25-Apr-2001  |
  | 2001: A Space Odyssey   | G      | 6-Apr-1968   |
  | The Incredibles         | PG     | 5-Nov-2004   |
  | Raiders of the Lost Ark | PG     | 12-Jun-1981  |
  | Chicken Run             | G      | 21-Jun-2000  |

以下是我的步骤定义:

When(/^I clicked "(.*?)"$/) do |arg1|
  if arg1 == "Movie Title"
   click_link ("title_header")
  end
end

Then(/^I expect "(.*)" before "(.*)"$/) do |arg1, arg2|
 assert page.body.expect =~ /arg1.*arg2/
end

我再次尝试解决的消息如下:

您可以使用这些 sn-ps 为未定义的步骤实现步骤定义:

Then(/^I expect to see "(.*?)" before "(.*?)"$/) do |arg1, arg2|
  pending # express the regexp above with the code you wish you had
end

感谢您的帮助。

【问题讨论】:

    标签: ruby-on-rails cucumber capybara


    【解决方案1】:

    您需要正确定义步骤,您在步骤定义中缺少“查看”

    【讨论】:

    • 显然我没有注意这一点。谢谢汤姆。
    猜你喜欢
    • 1970-01-01
    • 2019-11-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多