Sha256: e4ca1ced245e4ed3c341fb0362820f896349794467c470b34d295b6a719b4641

Contents?: true

Size: 825 Bytes

Versions: 11

Compression:

Stored size: 825 Bytes

Contents

require 'spec_helper'

RSpec.describe RockRMS::Response::PaymentMethod, type: :model do
  let(:parsed) { JSON.parse(FixturesHelper.read('payment_methods.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

11 entries across 11 versions & 1 rubygems

Version Path
rock_rms-3.9.0 spec/rock_rms/response/payment_method_spec.rb
rock_rms-3.8.0 spec/rock_rms/response/payment_method_spec.rb
rock_rms-3.7.0 spec/rock_rms/response/payment_method_spec.rb
rock_rms-3.6.3 spec/rock_rms/response/payment_method_spec.rb
rock_rms-3.6.2 spec/rock_rms/response/payment_method_spec.rb
rock_rms-3.6.1 spec/rock_rms/response/payment_method_spec.rb
rock_rms-3.6.0 spec/rock_rms/response/payment_method_spec.rb
rock_rms-3.5.0 spec/rock_rms/response/payment_method_spec.rb
rock_rms-3.4.1 spec/rock_rms/response/payment_method_spec.rb
rock_rms-3.4.0 spec/rock_rms/response/payment_method_spec.rb
rock_rms-3.2.0 spec/rock_rms/response/payment_method_spec.rb