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 <[EMAIL PROTECTED]> wrote: > > On 9/25/07, David Chelimsky <[EMAIL PROTECTED]> wrote: > > On 9/25/07, Jonathan Linowes <[EMAIL PROTECTED]> 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 > [email protected] > http://rubyforge.org/mailman/listinfo/rspec-users >
_______________________________________________ rspec-users mailing list [email protected] http://rubyforge.org/mailman/listinfo/rspec-users
