Sha256: 2dfadc0fa67fc8900e89fd7024f44d34a963847186bff93ec4a706eaf06b4d98

Contents?: true

Size: 825 Bytes

Versions: 109

Compression:

Stored size: 825 Bytes

Contents

require 'spec_helper'

RSpec.describe RockRMS::Response::PaymentDetail, type: :model do
  let(:parsed) { JSON.parse(FixturesHelper.read('payment_details.json')) }

  describe '.format' do
    subject(:result) { described_class.format(parsed) }

    context 'when response is array' do
      it 'returns an array' do
        expect(described_class.format([])).to be_a(Array)
      end
    end

    it 'translates keys' do
      result.zip(parsed) do |r, p|
        expect(r[:id]).to eq(p['Id'])
        expect(r[:exp_month]).to eq(p['ExpirationMonth'])
        expect(r[:exp_year]).to eq(p['ExpirationYear'])
        expect(r[:foreign_key]).to eq(p['ForeignKey'])
        expect(r[:payment_type_id]).to eq(p['CurrencyTypeValueId'])
        expect(r[:masked_number]).to eq(p['AccountNumberMasked'])
      end
    end
  end
end

Version data entries

109 entries across 109 versions & 1 rubygems

Version Path
rock_rms-9.13.0 spec/rock_rms/response/payment_detail_spec.rb
rock_rms-9.12.0 spec/rock_rms/response/payment_detail_spec.rb
rock_rms-9.11.0 spec/rock_rms/response/payment_detail_spec.rb
rock_rms-9.10.0 spec/rock_rms/response/payment_detail_spec.rb
rock_rms-9.9.0 spec/rock_rms/response/payment_detail_spec.rb
rock_rms-9.8.0 spec/rock_rms/response/payment_detail_spec.rb
rock_rms-9.7.0 spec/rock_rms/response/payment_detail_spec.rb
rock_rms-9.6.0 spec/rock_rms/response/payment_detail_spec.rb
rock_rms-9.5.0 spec/rock_rms/response/payment_detail_spec.rb
rock_rms-9.4.0 spec/rock_rms/response/payment_detail_spec.rb
rock_rms-9.3.0 spec/rock_rms/response/payment_detail_spec.rb
rock_rms-9.2.0 spec/rock_rms/response/payment_detail_spec.rb
rock_rms-9.1.0 spec/rock_rms/response/payment_detail_spec.rb
rock_rms-9.0.0 spec/rock_rms/response/payment_detail_spec.rb
rock_rms-8.23.0 spec/rock_rms/response/payment_detail_spec.rb
rock_rms-8.22.0 spec/rock_rms/response/payment_detail_spec.rb
rock_rms-8.21.0 spec/rock_rms/response/payment_detail_spec.rb
rock_rms-8.20.0 spec/rock_rms/response/payment_detail_spec.rb
rock_rms-8.19.0 spec/rock_rms/response/payment_detail_spec.rb
rock_rms-8.18.0 spec/rock_rms/response/payment_detail_spec.rb