[rspec-users] Noob syntax questions regarding rspec book...

Chris Sund chris at silhouettesolutions.net
Tue Jul 7 11:35:01 EDT 2009


Hey Everyone,

I've been working my way through the Rspec book trying to absorb and
understand everything. This is my first time with BDD and I'm just
trying to figure out some simple syntax stuff. My questions revolve
around some of the syntaxing used in the book. These are really simple
questions.


1.) Given /^the secret code is (. . . .)$/ do |code|
        Is (. . . .) simply a place holder? could I use something like
(- - - -) instead, or does it actually mean something?

2.) Then /^the mark should be (.*)$/ do |mark|
        Similar question....what does .* represent?



3.) In the following example why don't I pass   |guess| to the When
statement? I'm sure it has something to do with the (code.split)
syntax, I'm just not sure what.

When /^I guess (. . . .)$/ do |code|
@game.guess(code.split)
end


4.) And finally what does ("\n") do?

Then /^the mark should be (.*)$/ do |mark|
  @messenger.string.split("\n").should include(mark)
end





Thank You!

Chris


More information about the rspec-users mailing list