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"
精彩评论