I'm having a problem with my tests. In my application.rb, I've got the
unless request.path_info == session[:current_page]
session[:previous_page] = session[:current_page]
session[:current_page] = request.path_info
@previous_page = session[:previous_page] || '/'
This always lets me generate a "Back" link for my users that points to
the previous URL they were looking at, ignoring any
refreshes/reloads/validation error pages etc. that might be happening.
It works fine, until I test:
When I run this test, or any other test on my controller, I get:
NoMethodError: undefined method `path_info' for
It seems to me that the TestRequest object should have a path_info
method, right? If not, how do I code my app to do what I want, but have
the tests pass? Or, how do I rejigger my tests to get them to pass,
since I know the behavior of the app is correct?
Any help would be appreciated.