开发者

Specifying a query string in rspec

开发者 https://www.devze.com 2023-04-05 23:59 出处:网络
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 li

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

精彩评论

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