给定一个功能测试,例如:
def test_exciting_rails_upgrades
login(m=users(:manager))
post :import_users_map_fields, :csv_file => fixture_file_upload('/users.csv', 'text/csv')
assert flash.empty?
flash.discard
# other goodies omitted
end
在 Rails 2.3.2 中没有错误,但是在 2.3.15 中,错误是:
NoMethodError: {}:Hash 的未定义方法“丢弃” /test/functional/broken_upgrades.rb:119:in `test_exciting_rails_upgrades'
为什么是flash
一个Hash
类而不是一个FlashHash
?
从源代码来看,2.3.2 和 2.3.15 ActionPack 文件都 lib/action_controller/flash.rb
创建了FlashHash
类并继承自Hash
. 然而,在 2.3.2 和 2.3.15 的这个功能测试中显示的是一个Hash
类,而不是 a HashFlash
,所以不能对它调用 discard。
其他人可以用 2.3.15 重现此错误flash.discard
吗?