mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-04 02:31:33 +00:00
test: add spec for Spree::CreditCard#brand= setter to verify card type reformatting
This commit is contained in:
@@ -198,6 +198,15 @@ RSpec.describe Spree::CreditCard do
|
||||
end
|
||||
end
|
||||
|
||||
context "#brand=" do
|
||||
let(:credit_card) { build(:credit_card) }
|
||||
|
||||
it "delegates to #cc_type= and reformats the card type" do
|
||||
credit_card.brand = 'mastercard'
|
||||
expect(credit_card.cc_type).to eq 'master'
|
||||
end
|
||||
end
|
||||
|
||||
context "on save" do
|
||||
it "converts the card type format" do
|
||||
expect_any_instance_of(described_class).to receive(:reformat_card_type!).
|
||||
|
||||
Reference in New Issue
Block a user