[rspec-users] Testing an API I'm creating, need test server to be running
apnea.diving.deep at gmail.com
Tue Jan 17 15:10:24 EST 2012
Thanks for all your answers,
I should have said I'm very used to the workflow of integration specs
My question is really oriented towards API testing and particularly on
the use of Active Resource.
Basically, I'd like to:
a- create ActiveResource classes in rspec/support
b- run my tests
for a, I don't really know what URL I should provide
for b, according to what you said, this kind of tests should live in
Any more enlightenment? :)
On Jan 14, 5:36 pm, David Chelimsky <dchelim... at gmail.com> wrote:
> 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.
> > <snip/>
> >> 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.
> > <snip/>
> >> 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
> >> programmatically.
> > I'd recommend you check outhttps://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).
> rspec-users mailing list
> rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users
More information about the rspec-users