Sha256: b0323adff3b1c12391abec70743feb32ad6ed89eb1cd4461ee97194fc4234ad2

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

require 'uri'

describe Payanyway::Factories::PaymentUrlFactory do
  subject do
    parse_url = URI(described_class.build(params, false))

    Hash[ URI.decode_www_form(parse_url.query) ]
  end

  context 'when reset urls' do
    let(:params) {
      {
        amount: '120.25',
        transaction_id: 'FF790ABCD',
        success_url: 'success_url',
        in_progress_url: 'in_progress_url',
        fail_url: 'fail_url',
        return_url: 'return_url'
      }
    }

    its(['MNT_SUCCESS_URL']) { is_expected.to eq('success_url') }
    its(['MNT_INPROGRESS_URL']) { is_expected.to eq('in_progress_url') }
    its(['MNT_FAIL_URL']) { is_expected.to eq('fail_url') }
    its(['MNT_RETURN_URL']) { is_expected.to eq('return_url') }
  end

  context 'when set payment params' do
    let(:params) {
      {
        amount: '120.25',
        transaction_id: 'FF790ABCD',
        locale: 'ru',
        payment_system_unit_id: '1015',
        payment_system_limit_ids: '1015,1017'
      }
    }

    its(['moneta.locale']) { is_expected.to eq('ru') }
    its(['paymentSystem.unitId']) { is_expected.to eq('1015') }
    its(['paymentSystem.limitIds']) { is_expected.to eq('1015,1017') }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
payanyway-2.0.2 spec/lib/payanyway/factories/payment_url_factory_spec.rb
payanyway-2.0.1 spec/lib/payanyway/factories/payment_url_factory_spec.rb
payanyway-2.0.0 spec/lib/payanyway/factories/payment_url_factory_spec.rb