我可以寫與cookies請求罰款:我如何測試rspec簽名或永久cookie?
request.cookies['foo'] = 'bar'
但是,這些工作:
request.cookies.permanent['foo'] = 'bar'
request.cookies.signed['foo'] = 'bar'
request.cookies.permanent.signed['foo'] = 'bar' # what I really want
我得到空的哈希信息像這樣的消息:
NoMethodError:
undefined method `signed' for {}:Hash
如何我可以爲我的測試創建這些Cookie嗎?
我正在使用rails 3.1和rspec 2.6.0。
故障/錯誤:response.cookies.should_receive(:永久).once.and_return(餅乾) NoMethodError: 未定義的方法'should_receive」爲#<哈希: 0x007ffe4dcf34d0> –
必須啓用嘲諷 – bschaeffer