[rspec-users] Testing an API I'm creating, need test server to be running
dchelimsky at gmail.com
Sat Jan 14 11:36:03 EST 2012
On Jan 14, 2012, at 10:32 AM, David Chelimsky wrote:
> On Jan 14, 2012, at 8:40 AM, apneadiving wrote:
>> As I am writing a brand new API, I'd like to test it's response.
>> Basically, it would be great in my case to test if ActiveResource gets
>> the expected data but it means I have to launch a test server in
>> background for the whole suite.
>> Is there a convenient to handle this? Currently, I launch the test
>> server in console but it would be much better to have this handled
> I'd recommend you check out https://github.com/brynary/rack-test. It provides access to attributes of the request and the response object, and obviates the need for running a server. Take a look at its specs: https://github.com/brynary/rack-test/blob/master/spec/rack/test_spec.rb.
Of course, you get rack-test for free if you use request specs (which wrap Rails integration tests, which use rack-test).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rspec-users