Hacker News new | ask | show | jobs
by tamersalama 4843 days ago
"because Test Unit documentation is terrible"

Are you confusing Test Unit documentation with 'How/What to test' documentation? I can't think of any documentation required if what you use is a group of asserts.

Test::Unit in a nutshell: `test "should do something"; ...; end` is what gets run in each of the files. `setup` is called before each test. `teardown` is called after each test. use `assert_*` at your discretion.

1 comments

You know, recently I had reason to look into the teardown method (DatabaseCleaner, dontchaknow), and I never did find anything conclusive that it was something that test-unit used. Sure, it was mentioned in many many DatabaseCleaner questions/answers/threads, but nothing I could really rely on since invariably these were also using Rspec. That is, my unanswered question was "Is teardown solely an Rspec thing?"
Setup and teardown are in the Rails testing guide.

http://guides.rubyonrails.org/testing.html#setup-and-teardow...

I suppose so, but the readability of the guides are an (perhaps-idiosyncratic) issue for me.