0

私はこのキュウリの仕事をしています:

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]})

うまくいかない(次のステップに進み、#item_posting_day が見つからないというエラーが表示されます。)

しかし、代わりにこれを行うと:

tr:eq(4)

それは機能します (#item_posting_day フィールドを見つけ、その値を取得し、値が期待されるものではないというエラーを出しますが、それは問題ありません)。

したがって、この構文を使用することの何が問題なのかわかりません:

tr:eq(#{posting[:row]})
4

1 に答える 1

1

hashes列ヘッダーを記号ではなく文字列に変換するようです。'row'代わりに使用してみてください:row

于 2013-01-31T07:04:51.600 に答える