mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
add basic feature spec for authorisation table
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
%script{ type: "text/ng-template", id: "account/transactions.html" }
|
||||
- if @payments_requiring_action.present?
|
||||
.active_table
|
||||
%h3.requiring-authorization= t(".authorization_required")
|
||||
%h3.requiring-authorization= t(".authorisation_required")
|
||||
.small-12.columns
|
||||
%table
|
||||
%tr
|
||||
|
||||
42
spec/features/consumer/account/payments_spec.rb
Normal file
42
spec/features/consumer/account/payments_spec.rb
Normal file
@@ -0,0 +1,42 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature "Payments requiring action", js: true do
|
||||
include AuthenticationHelper
|
||||
|
||||
describe "as a logged in user" do
|
||||
let(:user) { create(:user) }
|
||||
let(:order) { create(:order, user: user) }
|
||||
|
||||
before do
|
||||
login_as user
|
||||
end
|
||||
|
||||
context "there is a payment requiring authorization" do
|
||||
let!(:payment) do
|
||||
create(:payment, order: order, cvv_response_message: "https://stripe.com/redirect")
|
||||
end
|
||||
|
||||
it "shows a table of payments requiring authorization" do
|
||||
visit "/account"
|
||||
|
||||
find("a", :text => %r{#{I18n.t('spree.users.show.tabs.transactions')}}i).click
|
||||
expect(page).to have_content I18n.t("spree.users.transactions.authorisation_required")
|
||||
end
|
||||
end
|
||||
|
||||
context "there are no payments requiring authorization" do
|
||||
let!(:payment) do
|
||||
create(:payment, order: order, cvv_response_message: nil)
|
||||
end
|
||||
|
||||
it "does not show the table of payments requiring authorization" do
|
||||
visit "/account"
|
||||
|
||||
find("a", :text => %r{#{I18n.t('spree.users.show.tabs.transactions')}}i).click
|
||||
expect(page).to_not have_content I18n.t("spree.users.transactions.authorisation_required")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user