You people are driving me batshit

So I’m noodling around with learning ruby and I’m trying to find a simple example of unit testing.

But no.

“simple ruby tdd example” yields a metric shitload of screen casts (sorry, no.)

Look people, I’ve been writing software for an awfully long time. I’m not going to sit through 15 minutes of screen casting.

NOR do I give a flying shit about Cucumber, rspec, BDD or, God fucking help me, rails.

Yet.

Just Ruby

Just unit testing.

Just 20 or so lines of code with 2 hello world tests (testing code external to the test code itself) in a complete “./rubytesthelloworld.rb” to make it go script. Let ME figure out what the code does. Trust me on this one. It’ll be quicker and I’ll understand it FAR better than trying to follow some code hippy’s insipid “narrative.”

Can ya point me to that? ’cause I haven’t been able to find it.

UPDATE: Solution found! I hoofed it over to the Barnes & Noble on Court Street and, after a little thumbing around, found on page 7 of ‘Ruby Best Practices’ (which, thank GOD, started with testing) the exact snippet I was looking for:


class MyThingieTest <Test::Unit::TestCase

def test_must_be_empty
# ...
end

def test_muse_be_awesome
# ...
end
end

(Yeah, yeah, indent it properly and all. Could probably use a WP plugin for proper code formatting.)

Tags: , ,

Leave a Reply