I use the sorcery gem to complete the login feature,and I have used the "remember me" feature.But I don't know how to write the test code with Rspec.I found the Capybara gem but don't know how to use it.
what I want to test is when I check the remember me box to login,and then logout with the admin username and password what I login last time,if not there is no any value.
can anybody give me some hint?thank you very much.
You could have 2 tests. I don't know exactly how your site works (or how remember me function works), so here is the basic idea.
Test 1: Remembers
Test 2: Does not remember
To go to the homepage with Capybara, use visit:
visit '/'
To check a box:
check 'remember_me'
You'll need to fill out the form and click on buttons.
Here is the Capybara reference: https://github.com/teamcapybara/capybara#using-capybara-with-rspec
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.