Inspired by the recent buzz over RubyMotion, of which I am a proud licensee, I wanted to play a little with MacRuby just to get into the swing of things.

After deciding that doing so was more worthwhile than to mow the lawn, I set out to see what it took to start a project in MacRuby with rSpec support as a basis to start work.

MacRuby's article got me started, but did not work because the test target could not find the framework that I wanted tested. I don't know why, since I (sort of) follwed the instructions there. I say "sort of" since the article shows screen-shots of an older Xcode, and even though I thought I set things correctly in my version (Xcode V4.3.2), it still would not build. Also, I am on Mac OS X Lion and that may have had something to do with it.

After realising that if I did not continue trying, a certain member of the household would make me mow that lawn, Google found another article here by Steve Madsen.

It too looked promising, but again, needed tweaking to get working in my environment. It's thanks to Steve's post that I managed to get it working.

Here were my steps:
a. Create a new project in Xcode (or use an existing one that you want to rSpec)
b. Install MacRuby
c. Follow Steve Madsen's instructions

At that stage it still did not work for me, but that was because of a misunderstaning that was clarified quickly enough:

Steve's screen-shot for the scheme settings on the Specs framework is cut off and does not show the "Expand Variables Based On" setting, so $(SRCROOT) was never expanded for me. I replaced it with an absolute path (ugh) and it worked, so I knew something was not picking up that macro. The solution was to give a value to that drop-down, as shown in the screen-shot below.

If, like me, you're on Xcode V4.3.2, you might find the following screen-shots useful (just refer to them as you follow Steve's post):

a. Build settings:
Image

b. Scheme settings:

Image

You cannot imagine the joy of seeing Ruby code drive an Objective-C framework testing session using rSpec in Xcode.

Now to that mower…