The page object pattern is a handy technique you can use to simplify the interaction with forms in a web app.
Take a look at this code in rspec.
Although capybara has a really great syntax, this can be troublesome with complex forms and prevents any code reuse.
This is the final code after refactored to use PO pattern.
The first thing is creating a spec/support folder.
The class is a simple PORO
The first thing is to require devise, capybara and rails helpers we need.
Then add the methods to the class, to chain methods just remember return self:
links:
article by Martin Fowler