[Rspec-devel] rSpec tutorial

Dominique Plante dominique.plante at gmail.com
Tue Aug 15 17:36:31 EDT 2006


Dear Dave:

This is a great tutorial!  I have read it all (and started coding some
of it), and I think it should be easy for most people to follow along.
 I like how you also demonstrate how to use mock, and get a fully
functional app going.  I haven't went through all the code at the
keyboard (yet), but tried to use enough to get me feet wet.

I'd like to mention that I am very excited about  rpsec, I don't
consider myself a ruby expert (by any means), I have seen your
presentation on rspec via google video, and also Steve Baker's talk on
rspec at the Silicon Valley Ruby Conference a while back...

I just thought I'd mention that you can play a game essentially like
Mastermind if you have a personalized google home page - look for the
deduction game when you add content (so people reading article can try
out a similar game).

Depending on who the audience is (or where this appears), you may want
to point people to stuff on CRC cards, where to find rspec, mock
objects etc... (or at least point out that they should have a fairly
good understanding of these things for this tutorial to be useful to
them)

When I tried to get the code going on my machine, I ran into some issues...

I'm on a windows box with ruby at c:\ruby, with ruby -v returning ruby
1.8.4 (2006-04-14) [i386-mswin32]

I installed rspec via gem install rspec (and got version 0.6.0)

I created the root folder for this in a folder e:\ruby\mastermind

>From looking at your command line output I noticed that the specs
should be going into specs (you don't mention this explicitly).

My Ruby isn't very good, so I couldn't put classes in modules and be able to do
require File.dirname(__FILE__) + '/../mastermind'

I did get classes the real classes to be recognized by rspec by
putting them into the same folder as the specs, and not putting in the
module declaration.  You might want to better describe the folder
structure you intended people to use for rubiots like myself.

(very minor) I also noticed that to get an error message on line 4:

NameError in 'An all white code with an all white guess should score 4
black pegs'
uninitialized constant Code
./specs/all_white_code_spec.rb:4:in `setup'
(page 3)

would require there to be no blank lines in the spec file

Finally here are various copy editing comments...

page 2 - (and loosing after 10) should be (and losing after 10)

page 2 - ... seeing how good the guess, is, and reporting back to the user.

could be written as:

.... seeing how good the player's guess is, and reporting the 'marks'
back to him/her.

page 3: in the footnote, used the wrong word 'he src folder' should be
'the src folder'

page 5:
"That could be to refactor to a better design, or to write the next
spec which will
drive us to generalize. In this case, we will do the latter."

could be written as:

"We could either decide to refactor to a better design, or write the
next spec which will drive us to generalize.  In this case, we will
choose the latter option."

page 5:
"See the works of Allen Holub 2 for a great treatment of this topic."

could be written as:

"See the works of Allen Holub 2 for a great treatment on this topic."

page 9:
"i.e. how many pegs in the guess exactly match pegs in the code (I
also cleaned up some
names):"

could be written as:

"i.e. how many pegs in the guess exactly match the color and placement
of the pegs in the code (I also cleaned up some names):"

page 11:
"Now to find pegs of the right colour in the wrong place."

could be written as:

"Now we need to find the pegs that are in the wrong place, but have
the wrong but have the right color."

page 29:
Back to our Regularly Scheduled Develpment

missing o in Development


Hope this helps!
Dominique

-------------------------------------------------------------
dom.website = http://www.binaryshift.com


More information about the Rspec-devel mailing list