leah blogs: October 2006

25oct2006 · Sexkurs und Blutigel

Damit kein deutsches Kulturgut verloren geht:

Was labert die Tante?

Ich schweige wie ein Grab, das Grab eines Lebendigen!

Li-Ion-er Akku

Gegen Osteoporose bei Frauen: Nicht nur Milch geben, sondern auch Milch trinken.

Sexkurs

Blutigel

NP: Sum 41—No Reason

24oct2006 · I'm not gonna digg you!

(Excuse the rant, but this style brings my point across in the best way.)

A new meme on the net is to add lots of “useful” link buttons to each blog post, titled like “Digg me!”, “Reddit me!”, “Add me to del.icio.us”. I’ve seen extreme cases with more than 25 icons like that.

Stop it, for fucks sake. Do you remember the “Bookmark me!”-links of Web 0.9?

Do you really think I’m gonna “digg” you just because you have that bootload of links there that make it easy? If I used to “digg” stuff regularly (I don’t even have a Digg account, but I could post you at Anarchaia), I’d install some kind of bookmarklet, since most site owners are not as stupid to add these links all over their blogs. You, however, are just link doping.

Rather, convice me to “digg” your site because of good content, a clever idea, an insightful comment, a funny story. I’ve seen these too, on those sites. But the bad after taste of seeing 25 “post-me-to-where-the-fuck-ever” buttons only makes me angry.

Alternatively, add this useful “send-me-to-hell-button”: send me to hell.

NP: The Kooks—If Only

18oct2006 · Announcing test/spec 0.2, a BDD interface for Test::Unit

Today I’m releasing test/spec 0.2, a library to do BDD with Test::Unit.

(See below for changes in version 0.2.)

What is test/spec?

test/spec layers an RSpec-inspired interface on top of Test::Unit, so you can mix TDD and BDD (Behavior-Driven Development).

test/spec is a clean-room implementation that maps most kinds of Test::Unit assertions to a ‘should’-like syntax.

Consider this Test::Unit test case:

class TestFoo < Test::Unit::TestCase
  def test_should_bar
    assert_equal 5, 2 + 3
  end
end

In test/spec, it looks like this:

require 'test/spec'

context "Foo" do
  specify "should bar" do
    (2 + 3).should.equal 5
  end
end

test/spec does not include a mocking/stubbing-framework; use whichever you like to—FlexMock and Mocha have been tested.

test/spec has no dependencies outside Ruby 1.8.

Mixing test/spec and test/unit

test/spec and Test::Unit contexts/test cases can be intermixed freely, run in the same test and live in the same files. You can just add them to your Rake::TestTask, too. test/spec allows you to leverage your full existing Test::Unit infrastructure.

test/spec does not change Test::Unit with the exception of monkey-patching Test::Unit::TestSuite to order the test cases before running them. (This should not do any harm, but if you know a way around it, please tell me.)

Wrapped assertions

  • assert_equal: should.equal, should ==
  • assert_not_equal: should.not.equal, should.not ==
  • assert_same: should.be
  • assert_not_same: should.not.be
  • assert_nil: should.be.nil
  • assert_not_nil: should.not.be.nil
  • assert_in_delta: should.be.close
  • assert_match: should.match, should =~
  • assert_no_match: should.not.match, should.not =~
  • assert_instance_of: should.be.an.instance_of
  • assert_kind_of: should.be.a.kind_of
  • assert_respond_to: should.respond_to
  • assert_raise: should.raise
  • assert_nothing_raised: should.not.raise
  • assert_throws: should.throw
  • assert_nothing_thrown: should.not.throw
  • assert_block: should.satisfy

Additional assertions

These assertions are not included in Test::Unit, but have been added to test/spec for convenience:

  • should.not.satisfy
  • a.should.predicate (works like assert a.predicate?)
  • a.should.be operator (where operator is <, <=, >, >=, or ===)
  • should.output, to check what is printed

SpecDox and RDox

test/spec adds two additional test runners to Test::Unit, based on the console runner but with a different output format.

SpecDox, run with --runner=specdox (or -rs) looks like RSpec’s output:

spec.output
- works for print
- works for puts
- works with readline

RDox, run with --runner=rdox (or -rr) can be included for RDoc documentation (e.g. see SPECS):

== spec.output
* works for print
* works for puts
* works with readline

SpecDox and RDox work for Test::Unit too:

$ ruby -r test/spec test/testunit/test_testresult.rb -rs

Test::Unit::TC_TestResult
- fault notification
- passed?
- result changed notification

Finished in 0.106647 seconds.

3 specifications (30 requirements), 0 failures

specrb

Since version 0.2, test/spec features a standalone test runner called specrb. specrb is like an extended version of testrb, Test::Unit’s test runner, but has additional options. It can be used for plain Test::Unit suites, too.

$ specrb -a -s -n should.output

should.output
- works for print
- works for puts
- works with readline

Finished in 0.162571 seconds.

3 specifications (6 requirements), 0 failures

See specrb --help for the usage.

Changes in version 0.2

  • Better, module-based implementation
  • Official support for FlexMock and Mocha
  • More robust Should#output
  • Should#operator
  • Nested contexts
  • Standalone test/spec runner, specrb
  • -w warning free

Roadmap

  • Version 0.3 (November 2006): deprecate underscore forms.

  • Version 1.0 (Late November 2006): first stable release.

Contact

Please mail bugs, suggestions and patches to chneukirchen@gmail.com.

Darcs repository (“darcs send” is welcome for patches):
http://chneukirchen.org/repos/testspec

Thanks to

  • Eero Saynatkari for writing should.output.
  • Thomas Fuchs for script.aculo.us BDD testing which convinced me.
  • Dave Astels for BDD.
  • The RSpec team for API inspiration.
  • Nathaniel Talbott for Test::Unit.

Copying

Copyright (C) 2006 Christian Neukirchen
test/spec is licensed under the same terms as Ruby itself.

Where can I get it?

You can download test/spec 0.2 at:
http://chneukirchen.org/releases/testspec-0.2.0.tar.gz

Alternatively, you can checkout from the development repository with:

darcs get http://chneukirchen.org/repos/testspec

(Patches using “darcs send” are most welcome.)

Happy hacking and have a nice day, Christian Neukirchen

d59a0412f8930bf8354d1fe2e089a49d  testspec-0.2.0.tar.gz

NP: David Gilmour—Mihalis

09oct2006 · Dan Bern: Breathe

Wow, I didn’t manage to blog a lot lately. Luckily, the release of Dan Bern’s new album Breathe makes me chance that. It’s Dan’s first release since 2004, and although I didn’t have the change to listen to it a lot yet, I like it very much.

I still remember the day I was surfing on the net and for reasons I can’t remember stumbled upon ZopeZen, which (un)fortunately was down at that day (according to the timestamps, it was May 4, 2003). On the page explaining why it didn’t work, Andy McKay linked to MP3s of Dan Bern’s Jail and My Country II, and I listened to these boths songs all the weekend.

I definitely got hooked, and you probably can imagine how happy I was to find the Dan Bern Digital Archive. Actually, only Bob Dylan takes more of my disk space (well, he simply produced more: 4.5 GB vs. 2.0 GB).

I’d really like to pass on the flame, and while not everyone will like his music and style, maybe someone will become as happy as I’ve been.

There are full-length versions of Breathe and Trudy available online (why don’t more artists do that?). Enjoy, and get a copy if you like it.

NP: Dan Bern—Trudy

Copyright © 2004–2022