开发者

Specifying a query string in rspec

I'm integratin开发者_Go百科g with a 3rd party library that validates the query string with a hash (requiring that the order of the query string be preserved). Is there a way to pass a query string literal to rspec?

You can do it in TestUnit with

@request.env['QUERY_STRING'] = 'this=is&in=order'
post :whatever

But when you do that in rspec, the query string is not passed (to be precise, the action finds no parameters).


You have to really post the data.

@request.env['QUERY_STRING'].should eq 'this=is&in=order'
post :whatever, :this => "is", :in => "order" 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜