From e31ca46f87a368131abd151388aa4308667f7e7f Mon Sep 17 00:00:00 2001 From: Rishabh Saxena Date: Fri, 8 Jul 2016 00:59:24 +0530 Subject: [PATCH] submit form directly in tests --- app/views/payments/_payment.html.haml | 2 +- spec/features/ticket_purchases_spec.rb | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/views/payments/_payment.html.haml b/app/views/payments/_payment.html.haml index da08a240..33e88886 100644 --- a/app/views/payments/_payment.html.haml +++ b/app/views/payments/_payment.html.haml @@ -30,5 +30,5 @@ %a = number_to_currency @total_amount_to_pay .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" diff --git a/spec/features/ticket_purchases_spec.rb b/spec/features/ticket_purchases_spec.rb index 2d40d287..320f05f0 100644 --- a/spec/features/ticket_purchases_spec.rb +++ b/spec/features/ticket_purchases_spec.rb @@ -38,8 +38,7 @@ feature Registration do select Date.current.year + 2, from: 'expiration_year' fill_in 'card_verification_value', with: '123' fill_in 'credit_card_number', with: '4242424242424242' - - click_button 'Charge Card' + submit_form expect(current_path).to eq(conference_conference_registrations_path(conference.short_title)) payment = Payment.where(user_id: participant.id, conference_id: conference.id).first