[rspec-users] Using RSpec to drive the design of a GUI desktop application
eloy.de.enige at gmail.com
Sun Nov 18 07:36:10 EST 2007
Someone pinged me that you were interested in BDD with RubyCocoa (RC),
so I thought I'd just chip in.
I write my RC apps in a BDD way and as such support for it is included
When we release 0.0.2 I will also release a screencast on how I use
BDD with RC.
But the bottom-line is, like with so many other BDD code, to make
extensive use of mocking.
Because most of the times you don't want to test IF a NSTextField works,
you just want to test the behaviour of your code IF a text field
returns a specific value.
This is easily done with mocking.
Atm I don't use rSpec but rather test/spec.
So there are probably some hurdles to overcome if you really wish to
Hope this helps.
I've been using RSpec as a tool to create web applications for some time
now, in Rails, and using plain Ruby with WEBrick as well. The tool
needs and the story runner is great.
Now there are things that aren't solvable on the web, you'll need a
desktop application for those problems.
So I've toyed a bit around with various GUI libraries as wxRuby and
RubyCocoa, to get a feeling on how these libraries work and I love to
native OS X applications using cocoa.
Of course, the next question that arose in my head was:"How do I drive
design of an application using a BDD framework like RSpec?".
When writing a web application, it is relatively easy to simulate a HTTP
request to the app and crawl through the returned HTML, but for a
application it's different, right?
The format (html) handled between the application, and the toolkit
the actual screen isn't that open for a desktop application as it is
So, since we don't want to test the inner workings of the gui toolkit
only want to specify the behaviour of the code we write self, we must
framework somewhere, to capture the actual calls to this toolkit to
our code is doing the right thing. At least, that's how I see it
But how could that be done?
More information about the rspec-users