Add missing :cc_type attribute to default :credit_card factory

Fixes 5 specs, including:

  11) Spree::CreditCardsController#update when the specified credit card is found and the card is owned by the user when the update completes successfully renders a serialized copy of the updated card
      Failure/Error: object.cc_type.capitalize

      NoMethodError:
        undefined method `capitalize' for nil:NilClass
      # ./app/serializers/api/credit_card_serializer.rb:6:in `brand'
      # (eval):4:in `_fast_attributes'
      # ./app/controllers/spree/credit_cards_controller.rb:26:in `update'
      # ./spec/controllers/spree/credit_cards_controller_spec.rb:100:in `block (7 levels) in <top (required)>'
      # ./spec/controllers/spree/credit_cards_controller_spec.rb:100:in `block (6 levels) in <top (required)>'
      # ------------------
      # --- Caused by: ---
      # NoMethodError:
      #   undefined method `capitalize' for nil:NilClass
      #   ./app/serializers/api/credit_card_serializer.rb:6:in `brand'
This commit is contained in:
Matt-Yorkley
2020-03-02 22:07:20 +01:00
parent ddebd47e32
commit 6cb8bb2fc3

View File

@@ -164,6 +164,10 @@ FactoryBot.modify do
country { Spree::Country.find_by name: 'Australia' || Spree::Country.first }
end
factory :credit_card do
cc_type 'visa'
end
factory :payment do
transient do
distributor {