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

internetchris chris at silhouettesolutions.net
Thu Jul 9 00:43:35 EDT 2009


Hey everyone,

I appreciate the replies. After I posted I realized I was looking at
ruby code. It seems this is where my learning curve is going to take a
leap. I understand Rails, I am starting to understand Rspec and
Cucumber, and I understand programming. This is my second language,
but it's the first time I have had to learn something new. I come from
a foxpro background and it seems I need to dig into the Ruby language
a little more. I keep forgetting that Rails is simply a framework and
not the language - the same is true for Rspec. I hope to laugh at my
mistakes in a year or two :-)

Thanks!

Chris Sund

On Jul 7, 9:49 am, ssmithstone <stephen.smithst... at gmail.com> wrote:
> 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
>
> _______________________________________________
> rspec-users mailing list
> rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users


More information about the rspec-users mailing list