[rspec-users] Then I should be on /users/3/posts/8/comments/2/edit

Josh Knowles joshknowles at gmail.com
Fri Apr 10 00:58:07 EDT 2009

On Thu, Apr 9, 2009 at 11:27 PM, Gavin Hughes <lists at ruby-forum.com> wrote:
> The problem is actually this:
> And I fill in ...
> And I press "Create Comment"
> Then I should be on [the correct page, ie.
> /users/3/posts/8/comments/2/edit]
> How do you write a step for that?

Personally I try and stay away from step-matchers based on URLs. Do
you really care about what page you're on?

I would instead check the response for the "Thank you for posting" or
whatever message that you're probably showing.

If however you want to check the page, do something like
response.url.should == "/blah"

Josh Knowles
phone: 509-979-1593
email:  joshknowles at gmail.com
web:    http://joshknowles.com

More information about the rspec-users mailing list