Re: [Rails] testing a REST API that receives params in json and returns data in json

2013-09-08 Thread André Orvalho
Hi Emil, I have also found that link and that only shows GET requests. Its a very good example for those. But I need to make a pull request where I need to send data in JSON just like the example you posted here in cucumber, and I dont seem to find the way to do this in Rspec. at least I cant

Re: [Rails] testing a REST API that receives params in json and returns data in json

2013-09-08 Thread Dheeraj Kumar
Did you try reading the Rspec docs? Also, this would help you: http://edgeguides.rubyonrails.org/testing.html#what-to-include-in-your-functional-tests -- Dheeraj Kumar On Sunday 8 September 2013 at 4:44 PM, André Orvalho wrote: Hi Emil, I have also found that link and that only shows

Re: [Rails] testing a REST API that receives params in json and returns data in json

2013-09-08 Thread André Orvalho
Thanks everyone for your help, I have found the answer here http://stackoverflow.com/questions/18337609/rspec-request-test-merges-hashes-in-array-in-post-json-params It seems that the request parameters I was sending was not the correct ones. this worked it should return an error if there is

Re: [Rails] testing a REST API that receives params in json and returns data in json

2013-09-07 Thread André Orvalho
Hello there, I have found ur post while googlin. Its very useful if you wanna use cucumber. I dont like cucumber for many reasons and would like to use RSPEC to test this. do you know how to do it? If so can you help me? thanks for the help though, all the best, Andre -- You received this

Re: [Rails] testing a REST API that receives params in json and returns data in json

2013-09-07 Thread Emil S
This may help you : http://matthewlehner.net/rails-api-testing-guidelines/ On 8 September 2013 04:33, André Orvalho and...@benjamin.dk wrote: Hello there, I have found ur post while googlin. Its very useful if you wanna use cucumber. I dont like cucumber for many reasons and would like to

[Rails] testing a REST API that receives params in json and returns data in json

2013-09-05 Thread andreo
Hey everyone, This is a problem that has been bothering me for some time. I am building an API function that should receive data in json and response in json. My controller tests run fine(Since I abstract that the data gets there already decode from JSON and only the answer needs to be

Re: [Rails] testing a REST API that receives params in json and returns data in json

2013-09-05 Thread Emil S
What you are asking for is a way to test your API from the perspective of a client ( like curl ) . I wanted to do the same thing in a project I worked on, and I used Cucumber + Rack::Test + some JSON helper methods and I am really happy with how it worked out. I've blogged about this here :