I\'m sending a POST request in a Rails functional test like this:
post :create, collection: { name: \'New Collection\' }
collection
This is also a problem when testing POST actions with RSpec (v3.4).
A workaround is to mock the return value of request.GET
or request.query_string
methods.
it "should recognise a query parameter in post action" do
allow(subject.request).to receive(:query_string).and_return("api_key=my%20key")
@params = {collection: { name: 'New Collection' }}
expect(subject.request.query_string).to eq "api_key=my%20key"
post :create, @params
end