On Sun, Jan 15, 2012 at 3:36 AM, David C. [email protected]
wrote:
the expected data but it means I have to launch a test server in
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: rack-test/spec/rack/test_spec.rb at main · rack/rack-test · GitHub.
Of course, you get rack-test for free if you use request specs (which wrap
Rails integration tests, which use rack-test).
This could be considered to be off topic, but rack-test was advised…
Some think this issue is a trap for young players, others that it is
just a different test philosophy. Nonetheless:
After a while you will eventually face the fact that you have to
test responses from your whole ‘stack’, specifically all the
interactions of the different components, and rack-test does not do
this.
Better to bite this bullet early.
FWIW I have unit tests that are just that, and integration tests that
are, well, integration tests - which precludes (by definition) using
rack-test
To get interagtion tests running (quickly) you’ll likely need to use
Vagrant+Chef+VCR, or some such toolbox, to launch your test stack
(locally, AWS, Rackspace etc.)
Again, this is inevitable, so better to bite integration testing early
while things are simple - build the complexity incrementally over
time.
From someone who years ago wasted too many days trying to isolate
issues that rack-test happily passed.
Now at least you can’t say your weren’t forewarned
HTH
http://rubyforge.org/mailman/listinfo/rspec-users
–
πόλλ’ οἶδ ἀλώπηξ, ἀλλ’ ἐχῖνος ἓν μέγα
[The fox knows many things, but the hedgehog knows one big thing.]
Archilochus, Greek poet (c. 680 BC – c. 645 BC)
http://hedgehogshiatus.com