From 0bb90d764c325464da921bfdee16db2908891156 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bellet Date: Fri, 22 Jul 2022 14:44:11 +0200 Subject: [PATCH] Allow charges is disabled if no saved cards marked as default --- spec/system/consumer/account/cards_spec.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/spec/system/consumer/account/cards_spec.rb b/spec/system/consumer/account/cards_spec.rb index 12d79f1731..07e6422f73 100644 --- a/spec/system/consumer/account/cards_spec.rb +++ b/spec/system/consumer/account/cards_spec.rb @@ -121,5 +121,18 @@ describe "Credit Cards", js: true do end expect(non_default_card.reload.is_default).to be true end + + context "when no default card" do + before do + default_card.destroy + end + + it "then all 'allow_charges' inputs are disabled" do + visit "/account" + find("a", text: /Credit Cards/i).click + + expect(find_field('allow_charges', disabled: true)).to be_truthy + end + end end end