add basic feature spec for authorisation table

This commit is contained in:
Andy Brett
2021-02-22 13:02:30 -08:00
parent 83bc9d2a12
commit e5eb8f97f9
2 changed files with 43 additions and 1 deletions

View File

@@ -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

View 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