【发布时间】:2018-01-19 07:58:51
【问题描述】:
我正在编写一个失败的 rspec 测试
if URI(request.referrer).path.include?('cart')
我希望能够让 request.referrer 包含“购物车”
如果您有任何方法,请告诉我。
我尝试了以下方法,但它们不起作用:
@request.env['HTTP_REFERER']='http://localhost:port/account/cart/id'
post url, params
也试过了:
post url, params, {"HTTP_REFERER" => "http://localhost:port/account/cart/id"}
【问题讨论】:
-
这些是请求规范还是控制器规范?
标签: rspec http-referer