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

ssmithstone stephen.smithstone at gmail.com
Tue Jul 7 11:49:02 EDT 2009


I to am in the same situation and the meaning of the /^ $/ is a
regular expression so it matches yours features so in your features is
you do

Give some random text I guess some more random test

the code would run against that given method, hope that makes sense
and that's my view of the code

On Jul 7, 4:35 pm, Chris Sund <ch... at silhouettesolutions.net> 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-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users


More information about the rspec-users mailing list