Topic: How to map the CURL command to Unit testing in Rails

Hi,

I ran the below curl command in terminal

   

curl -d "message" http://localhost:8080/api/validate -u username:password

and is running as expected.

I am writing a functional test for the above in Rails. For doing this I have to call the `post` method and pass the arguments whatever I have done for `curl` to `post`.

   

post 'validate',:request => "message"

I am able to pass the request paramater successfully. But how do I pass the username and password that I am passing in Curl to the post method in rails. Please advise

Last edited by jbragadeesh (2011-04-27 02:54:14)

Re: How to map the CURL command to Unit testing in Rails

This may come in handy.
http://stackoverflow.com/questions/2103 … ional-test
aaron