submit form directly in tests

This commit is contained in:
Rishabh Saxena 2016-07-08 00:59:24 +05:30
parent 2e66e5807a
commit e31ca46f87
2 changed files with 2 additions and 3 deletions

View file

@ -30,5 +30,5 @@
%a %a
= number_to_currency @total_amount_to_pay = number_to_currency @total_amount_to_pay
.form-group .form-group
= f.submit "Charge Card", class: "btn btn-primary", id: "charge_card" = f.submit "Charge Card", class: "btn btn-primary"
= link_to "Cancel", conference_conference_registrations_path, class: "btn btn-danger" = link_to "Cancel", conference_conference_registrations_path, class: "btn btn-danger"

View file

@ -38,8 +38,7 @@ feature Registration do
select Date.current.year + 2, from: 'expiration_year' select Date.current.year + 2, from: 'expiration_year'
fill_in 'card_verification_value', with: '123' fill_in 'card_verification_value', with: '123'
fill_in 'credit_card_number', with: '4242424242424242' fill_in 'credit_card_number', with: '4242424242424242'
submit_form
click_button 'Charge Card'
expect(current_path).to eq(conference_conference_registrations_path(conference.short_title)) expect(current_path).to eq(conference_conference_registrations_path(conference.short_title))
payment = Payment.where(user_id: participant.id, conference_id: conference.id).first payment = Payment.where(user_id: participant.id, conference_id: conference.id).first