Steve Odom’s Capistrano rake tasks
Adam Greene’s s3.rake
Building rubyforge projects
Bowtie Tool for building configuration files, including Monit
Links for Capistrano, rake, deployment, etc.
Using xml with assert_select
Jamis Buck had a useful article about using xml with assert_tag, and so did Peter Marklund, but I wanted something slightly different.
Normally assert_select uses the @response.body string to test against, but it has another option. It'll take an HTML::Document as its first argument, so you can pass it any xml you like, from any source.
I just added a small helper to test_helper.rb called with_xml.
def with_xml xml, &block
doc = HTML::Document.new(xml, false, true)
assert_select doc.root, ':root', &block
end
And here's how to use it:
def test_foo
xml =<<SNRK
<foo>
<bar>
</bar>
</foo>
SNRK
with_xml xml do
assert_select 'foo:root bar'
end
end
** (two asterisks) in globs
Never realized before that two asterisks had special meaning in a file glob.
They mean “give me all directories recursively, including this directory.”
See the Dir documentation for the full details. And notice that it’s not documented everywhere you might expect; Pathname’s documentation doesn’t talk about it, for example.