[Rspec-devel] rSpec tutorial

Dominique Plante dominique.plante at gmail.com
Wed Aug 16 18:44:04 EDT 2006


The easiest way to install ruby for windows is via the one-click ruby
installer for windows ( go to
http://rubyinstaller.rubyforge.org/wiki/wiki.pl, then click on
download)  It should go very cleanly, but I would recommend you go to
a command prompt and type set and copy and paste all the output to a
text file in case your path or something else gets overwritten before
doing this.

A couple of other points/suggestions on the Mastermind Project pdf.

* In the intro, you might want to say Let's do some BDD to create the
mastermind game

*  In the first and third paragraph of your article, you use the term
"solution" (which you later refer to as the code").  In the CRC cards,
the solution and a guess are both a code.  Things might read more
clearly if you used solution where you currently use code, but leave
the Code class the way it is.

* In the introduction, you might also want to say that after any
guess, there will be between 0 - 4 white markers set based on the
guess, and 0 - 4 black markers set based on the guess, and maybe that
the the sum of white markers + black markers will never be greater
than 4.

* On page 2 of the article where you list all the classes and their
responsibilities, you may want to say "Game:  coordinates the play,
counts turns (with the game over after 10), gets input, sees how good
the guess is, and reports back to the user."

* You may want to put in the margin the name of the spec files you are
showing - I noticed that:
* on page 3 the spec is all_white_code_spec.rb
* the one on page 8 is all_white_code_with_all_black_guess_spec.rb
* the one on page 10 is one_peg_right_colour_wrong_place_spec.rb

* Page 5: "We added a method rather than [an - spelled a in your
article] attribute reader because...   Also, I guess I would have to
read those articles because I thought attr_reader and attr_writer were
better than accessors and mutators... (if I read what you wrote

* page 10: you might want to say under "Tallying white pegs" - "So we
are going to write a spec in which only one peg in the guess is the
right colour, but it is in the wrong spot."

* page 12: from looking at the output of spec, it seems like a new
spec was written or one was renamed - I think it's the latest version
of all_white_code_spec.rb -  I'm referring to
all_white_code_with_all_white_guessspec.rb, which following your
naming convention should have been

* page 12: found_at[each] = false - this line should be bolded (since
it is a new line)

* page 13: considerable -> considerably

* page 16: I think you mean to write "the concrete implementation of
this will be a thin wrapper around whatever *random* generator is
provided by the language/library in use."

* page 16: We will need a random generator that gives us a series of
integers between 0 and 5 inclusive (corresponding to the 6 allowable

* You use some of the really cool Ruby features, blocks, enumerable
methods... Which is great.... But to be honest the code in bold at
white = .... on page 11 started getting kind of hard for me to follow
(as well as the the code white = ... on page 12)... it's good that it
got a  little bit more readable by page 13 with any? !

Sorry I haven't finished re-reading past page 20 looking for the
really picky things...

It's still a great article!!!!!!!!!!!


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

More information about the Rspec-devel mailing list