Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
feature 'Guest creates a pledge', js: true do
VALID_CARD_NUMBER = '4242424242424242'
scenario 'using radio buttons to choose amount' do
school = create(:school)
visit school_path(school)
choose '$15'
fill_and_submit_pledge_form
expect(page).to have_content('Thank you for your donation')
end
def fill_and_submit_pledge_form
fill_in 'Email', with: 'tester@example.com'
fill_in 'Card number', with: VALID_CARD_NUMBER
fill_in 'Expires', with: '10/20'
fill_in 'Name on card', with: 'Ralph Robot'
fill_in 'Card code', with: '911'
click_button 'Send my monthly donation!'
end
end
@cgrusden

This comment has been minimized.

Copy link

@cgrusden cgrusden commented Jan 23, 2014

Nice work, Dan!

@cored

This comment has been minimized.

Copy link

@cored cored commented Feb 24, 2015

One of the things that I dislike about using capybara/rspec to write feature specs is that you loose the Given/When/Then format. At least is not obvious to my eyes.

@thewatts

This comment has been minimized.

Copy link

@thewatts thewatts commented Dec 3, 2015

@cored I haven't had much opportunity to try it - but there is a simple system by the author of capybara called turnip that gives those options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment