lundi 3 août 2015

rspec test a gem that requires HTTP requests

I'm writing a gem for rails, which uses incoming HTTP requests. What is the best way of testing this? I've got rspec installed and setup, which is fine for standard unit testing, but I'm really not sure of the best way to simulate HTTP requests.

These tests also need really to simulate an entire rails environment. As well as the request, it makes use of controllers helpers, models mixins etc. I had thought if maybe creating a test rails app, but that seems like overkill. Would I then have to write tests inside that rails app that confirm things are working correctly?

What approach do other people take, and what is generally considered best practice for something like this?

Thanks

Aucun commentaire:

Enregistrer un commentaire