Sha256: d9e7edbbba8c0897002b42fe435da670936a474ddc821096ecf09be4c9a5e22a

Contents?: true

Size: 770 Bytes

Versions: 1

Compression:

Stored size: 770 Bytes

Contents

require 'spec_helper'

module SpreeSignifyd
  describe CreditCardSerializer do
    let(:credit_card) { create(:credit_card) }
    let(:serialized_credit_card) { JSON.parse(CreditCardSerializer.new(credit_card).to_json) }

    context "node values" do
      it "cardHolderName" do
        expect(serialized_credit_card['cardHolderName']).to eq "#{credit_card.first_name} #{credit_card.last_name}"
      end

      it "last4" do
        expect(serialized_credit_card['last4']).to eq credit_card.last_digits
      end

      it "expiryMonth" do
        expect(serialized_credit_card['expiryMonth']).to eq credit_card.month.to_i
      end

      it "expiryYear" do
        expect(serialized_credit_card['expiryYear']).to eq credit_card.year.to_i
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_signifyd-1.1.0 spec/serializers/spree_signifyd/credit_card_serializer_spec.rb