-
Notifications
You must be signed in to change notification settings - Fork 250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Session#restore_state for restoring previous state after block execution #316
Conversation
…ecution This type of API is very helpful for testing access control in applications. I currently do something similar in the capybara-restore_state gem, but that reaches into rack-test internals, and I would like to have a public API for this so it isn't necessary to do so.
I think this is a great feature to add. I'm not sold on the naming but the concept is great. I'd probably solicit input from a wider audience to see what typical users of It's too bad Line 366 in 30b43cd
Or maybe we can make it a sub-class so people can opt into it for their tests. Or maybe it doesn't matter? One more question I have, is how to handle Line 119 in 30b43cd
|
In regards to naming, I agree My usage of this feature is typically not limited to a single request. It would be akin to: session.restore_state do
# get '/foo'
# post '/foo/bar'
end
# get '/foo' So adding this via an request-specific option would not be useful in my opinion, and I think having the block mean two different things (since it is already used for yielding the last response) would be confusing. For this reason, In terms of Restoring |
It helps to see an example, thanks. What about
I cannot help but feel like |
|
Would it make sense to have some kind of |
We already have the equivalent of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think we should find a better name.
I'll merge this now. We can always rename the method later if a better name is discovered. |
This type of API is very helpful for testing access control in
applications. I currently do something similar in the
capybara-restore_state gem, but that reaches into rack-test
internals, and I would like to have a public API for this so it
isn't necessary to do so.