Capybara : RSpec : filling and assertion tips

To use helper method you need to visit some web page like

visit '/signup'

For Text fields

fill 'user[email]', with: 'john@example.com'
fill_in 'user[name]', with: 'John Smith'
fill_in 'user[email]', with: 'john@example.com'

For Select box

select 'Annually', from: 'subscription_type'
# The `Annually` is the text not the value attribute
# 'subscription_type' is name attribute
select 'Monthly', from: 'subscription_type'

Continue reading