Closed lotyrin closed 7 years ago
Its not possible because it's middleware. And communication with it only possible on app level. E.g browser - server - app with injected midleware.
Actually with low level capybara driver (rack-test) it might be possible because in this case there is no server process. But it will look as hack.
The main goal of this gem is ability to manage app session on high level so that it can be used in acceptance testing with any capybara driver: rack-test, selenium, webkit, poltergeist, etc.
So you must navigate to this midleware urls in order to set/get data.
I haven't looked at the architecture here much yet, but would it not be possible to make requests to the middleware URLs out of band from capybara? With plain ruby http requests? Even in the case of a selenium remote, it seems possible to use the webdriver API to borrow its cookies to be able to make the request with unless I'm missing something.
Then we need 2 implementations. One for rack-test driver (no http stack) and second for another drivers (with http stack).
I'd like to keep it simple.
So in other words, when I use rack_session_access
it is not possible to write tests that assert anything based on current_path
?
No. It's possible. But before current_path assertion you should visit some page. And that actually makes sense.
E.g.
background do
logged_as user
and
scenario 'foo' do
visit dashboard_path
expect(page).to have_text('Welcome')
expect(page.current_path).to eq('/dashboard')
click_button 'Profile'
expect(page).to have_text('My Profile')
expect(page.current_path).to eq('/dashboard/profile')
end
Also make sure that BEFORE current patg assertion you have assertion that waits for feedback on user action.
It would be nice if with capybara integration, a fetch of session keys wouldn't affect the preexisting page visit.
e.g.