【发布时间】:2014-06-27 08:33:28
【问题描述】:
我正在将一个表从 cucumber 传递到 Ruby,尝试更改哈希值,然后我想将该表传递到下一步。哈希值发生变化,但表不受影响。我做错了什么,或者在这里遗漏了一些概念。请指教!
我的黄瓜示例:
Scenario: Change Table Value
Given I start with this table
| person | grade |
| Bob | 82 |
| Jim | 94 |
| Bill | 58 |
这是红宝石:
Given /^I start with this table$/ do |table|
puts "table is:"
puts table
table.hashes.each do |hash|
puts "hash is:"
puts hash
puts "hash['person'] = #{hash['person']}"
puts "assigning new name..."
hash['person'] = 'Superman'
puts "hash['person'] = #{hash['person']}"
puts "hash is:"
puts hash
end
puts "table is:"
puts table
end
输出显示哈希值确实发生了变化,但表的最终puts显示原表没有受到影响。
我想将该表作为新值的输入传递到下一步。
任何建议将不胜感激, 谢谢, 埃德
【问题讨论】: