require 'spec_helper'

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:12/2019"
  end
end

require 'spec_helper'

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

Fix credit card spec that was depending on current year
Fix credit card spec that was depending on current year

After this commit https://github.com/openfoodfoundation/spree/commit/5d93d1dedb0c727c9a78770d35a4363a16fa1691, this static fix was meant to fail https://github.com/openfoodfoundation/openfoodnetwork/commit/3f33e28839cc60dd28175becad8ed590bc51bb6e
