在使用极小的rails单元测试中,使用以下代码:
def test_notification
# ("Arrange" stuff here...)
get root_path
assert_predicate flash, blank?
end运行时,assert_predicate行将导致错误:
Minitest::UnexpectedError: TypeError: false is not a symbol nor a string
这里发生了什么事?
发布于 2017-11-20 14:33:24
问题是,blank?需要成为一个符号--在上面的代码片段中,它缺少了领先的:。修正后的代码:
def test_notification
# ("Arrange" stuff here...)
get root_path
assert_predicate flash, :blank?
endhttps://stackoverflow.com/questions/47394447
复制相似问题