using unicorn as a local development server
normalperson at yhbt.net
Fri Feb 24 23:10:22 UTC 2012
Matt Smith <matt at nearapogee.com> wrote:
> Eric Wong wrote:
> > Normally I just write integration tests (sometimes starting unicorn (or
> > zbatery) + hitting it with curl, but often just mocking a Rack env).
> > Unlike most folks that develop apps that run over HTTP, I have a strong
> > aversion to web browsers. I'd rather pipe curl output to "vim -" if I
> > have to look at any text output from the application.
> This is slightly off topic, so I will make this concise, or this can
> be taken offline.
> What you are talking about, Eric, is exactly the workflow I am working
> toward. I am almost there, but still too dependent on the browser. So
> 2 questions:
> 1) Would you share what you use for integrations tests for rails and
> rack apps in general? (rack test, minitest, capybara, etc.)
For Rack apps, I normally use test/unit (minitest in 1.9) + Rack::Mock*.
test/test_watcher.rb in raindrops is a public example of that.
I don't develop a lot of Rack apps, though. I haven't touched Rails in
ages, but last time I used test/unit and some builtin Rails test
If I'm testing within Ruby, I stay with test/unit because it's
bundled/maintained with the latest version(s) of Ruby. Back in the day,
I know some projects had trouble migrating to Ruby 1.9.1 because rspec
wasn't 1.9-compatible at the time (it is now).
Back to Unicorn (and Rainbows!)
For testing HTTP servers (or anything that interacts with
non-Ruby-components), I'll use scripts in other languages
(shell/Perl/awk) and external tools (e.g. curl) to shake out potential
I worry about "self-cancelling" bugs which can be hidden from tests
because I didn't understand something (often Ruby itself) well enough.
Ruby 1.9 encodings is/was especially confusing to me, so I reached
outside of Ruby in many cases.
 - git clone git://bogomips.org/raindrops
 - For the few Rack apps I write, almost all of them are APIs or
targeted at lynx or curl users. I hate pretty things :)
More information about the mongrel-unicorn