Files
openfoodnetwork/spec/serializers/api/credit_card_serializer_spec.rb
Maikel Linke dcb6f4676d Remove all unnecessary spec_helper require statements
The `.rspec` file is doing this for us.
2026-01-21 12:35:34 +11:00

15 lines
438 B
Ruby

# frozen_string_literal: true
RSpec.describe Api::CreditCardSerializer do
let(:card) { create(:credit_card) }
let(:serializer) { Api::CreditCardSerializer.new card }
it "serializes a credit card" do
expect(serializer.to_json).to match card.last_digits.to_s
end
it "formats an identifying string with the card number masked" do
expect(serializer.formatted).to eq "Visa x-1111 Exp:#{card.month}/#{card.year}"
end
end