Skip to the posts
Buffalo's neighborhood journals since 2003 🍀 Patrick Spicy Devil Logan🌭 Sahlen🥨 Weber Spank🥟 Pierogi🐸 Scaj🍺 Labatt Utica Pink Cherio❄️ Snow Murder

jim’s journal

📅 October 2007

RSpec with Autotest

· · 🌡️ 66°F

(You can totally skip reading this journal, I am writing this for me and my happiness.)

This is the best thing ever. I am so glad that I took the time to look at this a few weeks ago after sort of putting it off for the last six months. I won't bore you all with the details (that's what @james is around for), but I found a super awesome new tool for testing programs, I can't believe I didn't check it out six months ago when I first heard about it. (rspec)

Basically, instead of unit tests you write a live spec, that is continuously run as you code that notifies you of the status of all your tests open each save of a file. So now I don't even have to run my tests anymore, the freakin computer does it for me, and pops up a discrete message in the corner of the screen letting me know what's going on.

Happy tests:
image

Sad tests:
image

And writing tests with the new tool is also so much cleaner and nicer.

Old way (just random made up examples):

def test_something
  File.open("/tmp/file", 'W') do |f|
    f << test_data
  end 
  assert_equal "/tmp/file", Retrieve.file, "Should have found it!"
end


New way:

it "should find file path" do
  Retrieve.file.should equal("/tmp/file")
end


But, that is a bad example because it doesn't show all the mocking, like:

Retrieve.file("config") # => can not find
Retrieve.stub!(:file).expects("config").and_returns("/tmp/file")
Retrieve.file("config") # => "/tmp/file"


So that you can completely decouple all your tested classes from each other and external output, thus only testing very specific pieces of logic, and making testing ten times easier because you never have to set up infrastructure for it to work.

You can also just have empty tests, which act like a todo list - they show up when the tests run as pending, so it also acts like a roadmap.

image

Pumpkins

· · 🌡️ 69°F

I love Halloween, mostly for the pumpkins, the pumkin carving, and the pumpkin-seed eating. @james and I went and bought pumpkins today, yay!!!

Also I think I will be dressing up for the Halloween party as either a leopard (in honor of Mac OS X 10.5 Leopard) or else Speed Racer. I'll have to see which I can scramble to put together this week.

Finding a blue helmet might be harder then finding spots.

Leopard

· · 🌡️ 68°F

So, I preordered Apple Mac OS X 10.5 Leopard (™, ®, etc). This is what I'm looking forward to:

- Spaces / multiple workspaces
- Tabbed, internationalized terminal
- Time Machine
- Death of Metal
- Finder Improvements
- Learning Objective C 2.0 now that it's got GC
- Playing with the Cocoa-Ruby bridge.

But also to some new 10.5 only apps that are coming out shortly.

I Am Displeased.

· · 🌡️ 59°F

I do not feel very good, I think it is a cold or the flu. This displeases me greatly. I think it's the fault of @enknot who did not save me any flu vaccine.

I was fine this morning, went to work on-site at a client's all morning and then all of a sudden I'm congested and cough-y. Sniffling too.

This is awesome.

Around Town

· · 🌡️ 56°F

When I started programming with Ruby in 2004, there was only one book about it, now it has its own shelf.
image

Pink Kitchen-Aid appliances at Premier:
image

James' favortite Chinese place:
image

UNANONNA (#1 Grandma?)
image

Balloon Architecture Book / Kit (on clearance shelf):
image