[rspec-users] simple story, extract link

Andrew WC Brown omen.king at gmail.com
Tue Sep 25 18:32:56 EDT 2007


Hi Jon,

I've been having alot of fun with Story Runner this week.
I'm trying to find the time this week to do a screencast on story runner.

Here's an example of how I might write your story.

http://pastie.caboo.se/100835

I didn't use in my example how you'd like to check for the url.
I'm unsure or haven't clearly read over your goal. I'll take a look later.


On 9/25/07, David Chelimsky <dchelimsky at gmail.com> wrote:
>
> On 9/25/07, Jonathan Linowes <jonathan at parkerhill.com> wrote:
> > hi,
> >
> > I just started fooling around with story runner, thought I'd start
> > with a dead simple scenario:
> > The first thing I do when describing a site to someone is go to the
> > home page, and begin exploring public pages from there.
> > So, that seems like a good first story to spec out.
> >
> > And I'd really like to extract the actual link from the rendered page
> > (rather than just "assuming" in the spec), but I'm not sure how to do
> > that
> > Something like:
> >
> >        # alink = find tag 'div#home-banner-links a '  where
> > content=="About"
> >        # url = extract the href attribute from alink
> >        get url
> >
> > Here's the story so far: http://pastie.caboo.se/100810
>
> Some comments:
>
> The second scenario seems more like the right level of abstraction
> than the first. Using "should render_template" in a Story seems too
> low level to me. What's interesting is what is being displayed, not
> what template is being used to display it.
>
> The second scenario does a nicer job of that.
>
> One thing is that you won't be able to use the full URL. RailsStory
> wraps rails integration tests, which provide access to routing, but as
> paths, not URLs. So for href="http://0.0.0.0:3000/site_pages/about",
> you'd need to extract the "/site_pages/about" part and get that.
>
> Thoughts?
>
> >
> > I'd appreciate suggestions as this seems like something I'd like to
> > do alot. Thanks
> >
> > linoj
> >
> >
> > _______________________________________________
> > rspec-users mailing list
> > rspec-users at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/rspec-users
> >
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070925/11a0ef1a/attachment.html 


More information about the rspec-users mailing list