[rspec-users] Rspec teting API.

Sidu Ponnappa ckponnappa at gmail.com
Wed Aug 3 12:11:36 EDT 2011


Your controller specs should suffice for API specs.

Is there anything specific you want to do beyond assert the response code,
content type and some basic assertions against the body of the response?

You may want to take a look at http://github.com/c42/rspec-http for
asserting against response codes and some headers.

Best,
Sidu.
http://c42.in

On 2 August 2011 22:20, Kleber Correia <klebervirgilio at gmail.com> wrote:

> Hi!
>
> Guys, I wanna test an API built in Rails 3.0.3.
>
> So, my question is... What's the better way to test my own api?
>
> I guess that a requests specs like these:
>
> describe 'POST /client'
>  it 'works' do
>   assert_difference post '/clients', :client => {...}
>  end
> end
>
> can be appropriate...
>
> Someone just tested an API? I mean... simulate the requests to API.
> Tks!
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20110803/1e4ae2c0/attachment-0001.html>


More information about the rspec-users mailing list