Posts tagged as:

test::unit


Shoulda is a framework that sits on top of Test::Unit and adds a ton of nice features like macro’s, nested context, and the ability to create custom tests in a block-based DSL.
Download 160.2 MB
Download (iphone & ipod) 71.9 MB

{ 15 comments }

Having used both Test::Unit and RSpec, I have to agree with Jim Weirich: the difference between the two is primarily semantics. It seems to me that functionally, they are both equally capable of verifying and specifying code. However, the way in which you write the tests—the semantics—is the primary difference between the two. That being the case, I prefer the semantics of RSpec.
[click to continue…]

{ 6 comments }

I’ve been working on NORM and after a few proof of concept things, I wrote a test to test the create method for the base class.

Here’s the create method:

def create(attributes)
  columns = attributes.keys.join(", ")
  values = attributes.collect {|k, v| "'#{v}'"}.join(", ")
  @@connection.execute("INSERT INTO base (#{columns}) VALUES (#{values});")
  new(attributes)
end

I’ve written dozens of unit tests in Ruby on Rails, but what I didn’t realize was that the same library you use to test in Rails is the standard test/unit library came with the Ruby installation on my Windows machine. So, I wrote my own test which I later revised. [click to continue…]

{ 0 comments }