Difference between rspec style spec names and test unit? Three lines.

Posted by Tim Connor Tue, 24 Feb 2009 23:19:00 GMT

A discussion I overheard in irc made me wonder what possibilities would be opened up if instead of naming tests by convention (test_)all publicly accessible methods were run as tests. This lead down a path to this thought:

class RspecInTU
  class << self
    alias it define_method
  it "should say hello" do
    puts "hello"
RspecInTU.new.send "should say hello"

Forkable here

Technomancy told me that it’s easy to actually get miniunit to use all public methods as test methods and came up with a minimum working base

Of course, I wondered if Shoulda already did something like that, and some people confirmed that it does. It’s still neat.

Leave a comment