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

Yi Wen hayafirst at gmail.com
Tue Jul 7 11:46:38 EDT 2009


They are regex.
On Jul 7, 2009, at 10:35 AM, Chris Sund wrote:

> 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
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users



More information about the rspec-users mailing list