simple story, extract link

View: New views
8 Messages — Rating Filter:   Alert me  

simple story, extract link

by Jonathan Linowes :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

I'd appreciate suggestions as this seems like something I'd like to  
do alot. Thanks

linoj


_______________________________________________
rspec-users mailing list
rspec-users@...
http://rubyforge.org/mailman/listinfo/rspec-users

Re: simple story, extract link

by David Chelimsky-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 9/25/07, Jonathan Linowes <jonathan@...> 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@...
> http://rubyforge.org/mailman/listinfo/rspec-users
>
_______________________________________________
rspec-users mailing list
rspec-users@...
http://rubyforge.org/mailman/listinfo/rspec-users

Re: simple story, extract link

by OmenKing :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...> wrote:
On 9/25/07, Jonathan Linowes <jonathan@...> 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@...
> http://rubyforge.org/mailman/listinfo/rspec-users
>
_______________________________________________
rspec-users mailing list
rspec-users@...
http://rubyforge.org/mailman/listinfo/rspec-users


_______________________________________________
rspec-users mailing list
rspec-users@...
http://rubyforge.org/mailman/listinfo/rspec-users

Re: simple story, extract link

by Pat Maddox :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 9/25/07, David Chelimsky <dchelimsky@...> wrote:

> On 9/25/07, Jonathan Linowes <jonathan@...> 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.

I see what you're getting at.  I've thought about it a bit myself, and
have decided that expecting a certain template is a pragmatic way of
knowing that the user is on the right page.


> 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 was planning on implementing a
click_link "Follow me!"

sorta thing in the next couple days.  One problem I have is that right
now you still need to know too much about the underlying structure
(and golly if I didn't just contradict the first part of my reply!).
There was a thread a few days ago [1] where I hinted at that.  He
wanted to go directly to a URL, when he should have been following a
redirect.

I think there needs to be some mechanism for following links /
submitting forms so that you can really follow the path a user takes.
That leaves you with something like:

Story "Create an auction", %{
  As a seller
  I want to create a new auction
  So that I can get filthy rich
} do

  Scenario "Successful listing" do
    Given "A user" do
      User.create! :login => "pat", :password => "password"
    end
    And "user visits the login page" do
      get "/login"
    end
    And "user logs in" do
      submit_form :login, :login => "pat", :password => "password"
    end
    And "user visits new auction page" do
      click_link "Create an auction"
    end
    When "user creates auction" do
      submit_form :auction, :auction => { :item_name => "Ruby for
Rails", :price => 50 }
    end
    Then "new auction should be listed" do
      response.should have_text(/Item successfully created!/)
      response.should have_text(/Ruby for Rails/)
    end
  end
end

That requires you to know
1. Point of entry
2. IDs of forms and links (or text for links, if you prefer)
3. The fields that a form uses

So really all we've gotten away from is dependency on knowing certain
URLs, which I'm not positive is a huge benefit...otoh, this is closer
to tracing a user's path through the app which is nice.

wdyt?

Pat

[1] http://rubyforge.org/pipermail/rspec-users/2007-September/003344.html
_______________________________________________
rspec-users mailing list
rspec-users@...
http://rubyforge.org/mailman/listinfo/rspec-users

Re: simple story, extract link

by Jonathan Linowes :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

yep, in my case I'm imagining a next scenario may go something like  
this:
- from home page, click on Contact Us,
see contact form, fill out fields,
submit form, see thank you page,
email sent to admin


On Sep 25, 2007, at 6:48 PM, Pat Maddox wrote:

> On 9/25/07, David Chelimsky <dchelimsky@...> wrote:
>> On 9/25/07, Jonathan Linowes <jonathan@...> 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.
>
> I see what you're getting at.  I've thought about it a bit myself, and
> have decided that expecting a certain template is a pragmatic way of
> knowing that the user is on the right page.
>
>
>> 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 was planning on implementing a
> click_link "Follow me!"
>
> sorta thing in the next couple days.  One problem I have is that right
> now you still need to know too much about the underlying structure
> (and golly if I didn't just contradict the first part of my reply!).
> There was a thread a few days ago [1] where I hinted at that.  He
> wanted to go directly to a URL, when he should have been following a
> redirect.
>
> I think there needs to be some mechanism for following links /
> submitting forms so that you can really follow the path a user takes.
> That leaves you with something like:
>
> Story "Create an auction", %{
>   As a seller
>   I want to create a new auction
>   So that I can get filthy rich
> } do
>
>   Scenario "Successful listing" do
>     Given "A user" do
>       User.create! :login => "pat", :password => "password"
>     end
>     And "user visits the login page" do
>       get "/login"
>     end
>     And "user logs in" do
>       submit_form :login, :login => "pat", :password => "password"
>     end
>     And "user visits new auction page" do
>       click_link "Create an auction"
>     end
>     When "user creates auction" do
>       submit_form :auction, :auction => { :item_name => "Ruby for
> Rails", :price => 50 }
>     end
>     Then "new auction should be listed" do
>       response.should have_text(/Item successfully created!/)
>       response.should have_text(/Ruby for Rails/)
>     end
>   end
> end
>
> That requires you to know
> 1. Point of entry
> 2. IDs of forms and links (or text for links, if you prefer)
> 3. The fields that a form uses
>
> So really all we've gotten away from is dependency on knowing certain
> URLs, which I'm not positive is a huge benefit...otoh, this is closer
> to tracing a user's path through the app which is nice.
>
> wdyt?
>
> Pat
>
> [1] http://rubyforge.org/pipermail/rspec-users/2007-September/ 
> 003344.html
> _______________________________________________
> rspec-users mailing list
> rspec-users@...
> http://rubyforge.org/mailman/listinfo/rspec-users

_______________________________________________
rspec-users mailing list
rspec-users@...
http://rubyforge.org/mailman/listinfo/rspec-users

Re: simple story, extract link

by OmenKing :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Oh that was my post a few days ago.
I was trying to emulate the following:

Jon is logging onto the forum so he can create a new topic.
When Jon logs on he is redirected the home page by default.
Jon then clicks on the general forum
so he go create a topic.

This following seemed out of place.
I thought it was necessary to emulate a user clicking a link on the home page to the forums/1
I thought thats the path the user takes.

And "user is looking at", "/forums/1" do |path|
  get path
  response.should be_success
end

It just seemed that I was suppose to include the user going to that page before creating the topic.


On 9/25/07, Pat Maddox <pergesu@...> wrote:
On 9/25/07, David Chelimsky <dchelimsky@...> wrote:

> On 9/25/07, Jonathan Linowes <jonathan@...> 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.

I see what you're getting at.  I've thought about it a bit myself, and
have decided that expecting a certain template is a pragmatic way of
knowing that the user is on the right page.


> 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 was planning on implementing a
click_link "Follow me!"

sorta thing in the next couple days.  One problem I have is that right
now you still need to know too much about the underlying structure
(and golly if I didn't just contradict the first part of my reply!).
There was a thread a few days ago [1] where I hinted at that.  He
wanted to go directly to a URL, when he should have been following a
redirect.

I think there needs to be some mechanism for following links /
submitting forms so that you can really follow the path a user takes.
That leaves you with something like:

Story "Create an auction", %{
  As a seller
  I want to create a new auction
  So that I can get filthy rich
} do

  Scenario "Successful listing" do
    Given "A user" do
      User.create! :login => "pat", :password => "password"
    end
    And "user visits the login page" do
      get "/login"
    end
    And "user logs in" do
      submit_form :login, :login => "pat", :password => "password"
    end
    And "user visits new auction page" do
      click_link "Create an auction"
    end
    When "user creates auction" do
      submit_form :auction, :auction => { :item_name => "Ruby for
Rails", :price => 50 }
    end
    Then "new auction should be listed" do
      response.should have_text(/Item successfully created!/)
      response.should have_text(/Ruby for Rails/)
    end
  end
end

That requires you to know
1. Point of entry
2. IDs of forms and links (or text for links, if you prefer)
3. The fields that a form uses

So really all we've gotten away from is dependency on knowing certain
URLs, which I'm not positive is a huge benefit...otoh, this is closer
to tracing a user's path through the app which is nice.

wdyt?

Pat

[1] http://rubyforge.org/pipermail/rspec-users/2007-September/003344.html
_______________________________________________
rspec-users mailing list
rspec-users@...
http://rubyforge.org/mailman/listinfo/rspec-users


_______________________________________________
rspec-users mailing list
rspec-users@...
http://rubyforge.org/mailman/listinfo/rspec-users

Re: simple story, extract link

by Jonathan Linowes :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Pat,

Any more thoughts on submit_form and follow_link? I really like that  
idea, it fits well with the story concept, imo . And using the links  
and forms inside the response is better coverage than assuming the  
entry point to the next page.

So a scenario becomes a sequence of actions taken by the user to  
accomplish a task (however small or large).
In which case, could you have multiple When-Then's ? eg from your  
example


>   Scenario "Successful listing" do
>     Given "A user" do
>       User.create! :login => "pat", :password => "password"
>     end
>     When "user visits the login page" do
>       get "/login"
>     end
        Then "user sees login page" do
           response.should have_text(/Please login/)
        end
>     When "user logs in" do
>       submit_form :login, :login => "pat", :password => "password"
>     end
        Then "page shows Create an auction" do
           response.should have_tag(...)
       end

>     When "user visits new auction page" do
>       click_link "Create an auction"
>     end
>     When "user creates auction" do
>       submit_form :auction, :auction => { :item_name => "Ruby for
> Rails", :price => 50 }
>     end
>     Then "new auction should be listed" do
>       response.should have_text(/Item successfully created!/)
>       response.should have_text(/Ruby for Rails/)
>     end
>   end


I realize this goes against http://dannorth.net/whats-in-a-story but  
it seems more correct than putting those actions into Given clauses.


On Sep 25, 2007, at 6:48 PM, Pat Maddox wrote:

> On 9/25/07, David Chelimsky <dchelimsky@...> wrote:
>> On 9/25/07, Jonathan Linowes <jonathan@...> 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.
>
> I see what you're getting at.  I've thought about it a bit myself, and
> have decided that expecting a certain template is a pragmatic way of
> knowing that the user is on the right page.
>
>
>> 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 was planning on implementing a
> click_link "Follow me!"
>
> sorta thing in the next couple days.  One problem I have is that right
> now you still need to know too much about the underlying structure
> (and golly if I didn't just contradict the first part of my reply!).
> There was a thread a few days ago [1] where I hinted at that.  He
> wanted to go directly to a URL, when he should have been following a
> redirect.
>
> I think there needs to be some mechanism for following links /
> submitting forms so that you can really follow the path a user takes.
> That leaves you with something like:
>
> Story "Create an auction", %{
>   As a seller
>   I want to create a new auction
>   So that I can get filthy rich
> } do
>
>   Scenario "Successful listing" do
>     Given "A user" do
>       User.create! :login => "pat", :password => "password"
>     end
>     And "user visits the login page" do
>       get "/login"
>     end
>     And "user logs in" do
>       submit_form :login, :login => "pat", :password => "password"
>     end
>     And "user visits new auction page" do
>       click_link "Create an auction"
>     end
>     When "user creates auction" do
>       submit_form :auction, :auction => { :item_name => "Ruby for
> Rails", :price => 50 }
>     end
>     Then "new auction should be listed" do
>       response.should have_text(/Item successfully created!/)
>       response.should have_text(/Ruby for Rails/)
>     end
>   end
> end
>
> That requires you to know
> 1. Point of entry
> 2. IDs of forms and links (or text for links, if you prefer)
> 3. The fields that a form uses
>
> So really all we've gotten away from is dependency on knowing certain
> URLs, which I'm not positive is a huge benefit...otoh, this is closer
> to tracing a user's path through the app which is nice.
>
> wdyt?
>
> Pat
>
> [1] http://rubyforge.org/pipermail/rspec-users/2007-September/ 
> 003344.html
> _______________________________________________
> rspec-users mailing list
> rspec-users@...
> http://rubyforge.org/mailman/listinfo/rspec-users

_______________________________________________
rspec-users mailing list
rspec-users@...
http://rubyforge.org/mailman/listinfo/rspec-users

Re: simple story, extract link

by Dan North-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Jonathan.

You can think of the What's in a Story article as trainer wheels. The point is to start thinking in givens, events and outcomes (ie. which activities in this scenario are setting up context, which are the "interesting bits" and which are verification).

Once you are comfortable with this, it is perfectly natural to want multiple steps interleaved. A very common pattern is to have some Givens then repeating sequences of Whens and Thens, which represent various operations through a user scenario. So you might say:

Given I am on the login screen

When I enter my credentials
Then I should be on the summaries page

When I select an entry
Then I should see its detail

When I delete the entry
Then I should be back on the summary page
And the deleted entry should have disappeared

As long as you are aware what each stanza represents ("I should be back on the summary page" is an outcome, "I select an entry" is an event, etc.) then you're definitely on the right lines.

I just found a paragraph from the article that might help:

"Not all scenarios are this simple. Some are best represented as a sequence of events, described as: given [some context] when [I do something] then [this happens] when [I do another thing] then [this new thing happens] and so on. An example is a wizard-style website, where you step through a sequence of screens to build up a complex data model. It is perfectly appropriate to intermingle sequences of events and outcomes, as long as you get into the habit of thinking in these terms."

Thanks,
Dan


On 10/3/07, Jonathan Linowes <jonathan@...> wrote:
Pat,

Any more thoughts on submit_form and follow_link? I really like that
idea, it fits well with the story concept, imo . And using the links
and forms inside the response is better coverage than assuming the
entry point to the next page.

So a scenario becomes a sequence of actions taken by the user to
accomplish a task (however small or large).
In which case, could you have multiple When-Then's ? eg from your
example


>   Scenario "Successful listing" do
>     Given "A user" do
>       User.create! :login => "pat", :password => "password"
>     end
>     When "user visits the login page" do
>       get "/login"
>     end
        Then "user sees login page" do
           response.should have_text(/Please login/)
        end
>     When "user logs in" do
>       submit_form :login, :login => "pat", :password => "password"
>     end
        Then "page shows Create an auction" do
           response.should have_tag(...)
       end

>     When "user visits new auction page" do
>       click_link "Create an auction"
>     end
>     When "user creates auction" do
>       submit_form :auction, :auction => { :item_name => "Ruby for
> Rails", :price => 50 }
>     end
>     Then "new auction should be listed" do
>       response.should have_text(/Item successfully created!/)
>       response.should have_text(/Ruby for Rails/)
>     end
>   end


I realize this goes against http://dannorth.net/whats-in-a-story but
it seems more correct than putting those actions into Given clauses.


On Sep 25, 2007, at 6:48 PM, Pat Maddox wrote:

> On 9/25/07, David Chelimsky <dchelimsky@...> wrote:
>> On 9/25/07, Jonathan Linowes <jonathan@...> 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.
>
> I see what you're getting at.  I've thought about it a bit myself, and
> have decided that expecting a certain template is a pragmatic way of
> knowing that the user is on the right page.
>
>
>> 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 was planning on implementing a
> click_link "Follow me!"
>
> sorta thing in the next couple days.  One problem I have is that right
> now you still need to know too much about the underlying structure
> (and golly if I didn't just contradict the first part of my reply!).
> There was a thread a few days ago [1] where I hinted at that.  He
> wanted to go directly to a URL, when he should have been following a
> redirect.
>
> I think there needs to be some mechanism for following links /
> submitting forms so that you can really follow the path a user takes.
> That leaves you with something like:
>
> Story "Create an auction", %{
>   As a seller
>   I want to create a new auction
>   So that I can get filthy rich
> } do
>
>   Scenario "Successful listing" do
>     Given "A user" do
>       User.create! :login => "pat", :password => "password"
>     end
>     And "user visits the login page" do
>       get "/login"
>     end
>     And "user logs in" do
>       submit_form :login, :login => "pat", :password => "password"
>     end
>     And "user visits new auction page" do
>       click_link "Create an auction"
>     end
>     When "user creates auction" do
>       submit_form :auction, :auction => { :item_name => "Ruby for
> Rails", :price => 50 }
>     end
>     Then "new auction should be listed" do
>       response.should have_text(/Item successfully created!/)
>       response.should have_text(/Ruby for Rails/)
>     end
>   end
> end
>
> That requires you to know
> 1. Point of entry
> 2. IDs of forms and links (or text for links, if you prefer)
> 3. The fields that a form uses
>

> So really all we've gotten away from is dependency on knowing certain
> URLs, which I'm not positive is a huge benefit...otoh, this is closer
> to tracing a user's path through the app which is nice.
>
> wdyt?
>
> Pat
>
> [1] http://rubyforge.org/pipermail/rspec-users/2007-September/
> 003344.html
> _______________________________________________
> rspec-users mailing list
> rspec-users@...
> http://rubyforge.org/mailman/listinfo/rspec-users

_______________________________________________
rspec-users mailing list
rspec-users@...
http://rubyforge.org/mailman/listinfo/rspec-users


_______________________________________________
rspec-users mailing list
rspec-users@...
http://rubyforge.org/mailman/listinfo/rspec-users