Capybara: expect field to have value

by Jason Swett,

I commonly find myself wanting to assert that a certain field contains a certain value. The way to do this with Capybara is documented on StackOverflow but, unfortunately, the answer there is buried in a little too much noise. I decided to create my own tiny noise-free blog post that contains the answer. Here it is:

expect(page).to have_field('Name', with: 'Abraham Lincoln')

2 thoughts on “Capybara: expect field to have value

Leave a Reply

Your email address will not be published. Required fields are marked *