Ruby on rails 黄瓜桌+;查找(“表tr:eq(x)”不正常

Ruby on rails 黄瓜桌+;查找(“表tr:eq(x)”不正常,ruby-on-rails,cucumber,Ruby On Rails,Cucumber,我的任务是: Then I should see following posting modes | row | day | hour | minute | location | category | | 1 | 1 | 7 | 0 | 29 | 6 | | 2 | 2 | 8 | 5 | 27 | 7 | | 3 | 3

我的任务是:

Then I should see following posting modes
        | row | day  | hour | minute | location | category |
        | 1   | 1    | 7    | 0      | 29       | 6        |
        | 2   | 2    | 8    | 5      | 27       | 7        |
        | 3   | 3    | 9    | 10     | 28       | 18       |
        | 4   | 4    | 15   | 15     | 29       | 18       |
        | 5   | 5    | 17   | 20     | 27       | 7        |
        | 6   | 6    | 20   | 30     | 28       | 6        |
        | 6   | 0    | 22   | 50     | 29       | 7        |
它的背后是这样的描述:

Then /^I should see following posting modes$/ do |table|
  table.hashes.each do |posting|
      within("#itemPosting .attributeContainer table tbody tr:eq(#{posting[:row]})") do
            find("#item_posting_day").value.should == posting[:day]
            find("#item_posting_hour").value.should == posting[:hour]
            find("#item_posting_minute").value.should == posting[:minute]
            find("#item_posting_location").value.should == posting[:location]
            find("#item_posting_category").value.should == posting[:category]
      end
  end  
end
所以这一部分:

tr:eq(#{posting[:row]})
不起作用(它转到下一步,然后给出一个错误,即“未找到项目发布日”。)

但如果我这样做:

tr:eq(4)
它可以工作(找到#item_posting_day字段,获取其值,然后给出一个错误,表示该值不是预期值,但这没关系)

所以我不明白使用这种语法有什么问题:

tr:eq(#{posting[:row]})
似乎是将列标题转换为字符串,而不是符号。尝试使用
'row'
而不是
:row