Sha256: c1d48a24ec88ea5c81f3ad304683bb3f3d7e48484e9d6569feaf1c10c4241461

Contents?: true

Size: 1.36 KB

Versions: 4

Compression:

Stored size: 1.36 KB

Contents

describe Payanyway::Gateway do
  describe '#payment_url' do
    let(:use_signature) { false }
    subject { described_class.payment_url(params, use_signature) }

    context 'when min params' do
      let(:params) { { amount: '120.25', transaction_id: 'FF790ABCD' } }

      it { is_expected.to eq('https://demo.moneta.ru/assistant.htm?MNT_ID=141290&MNT_CURRENCY_CODE=RUB&MNT_TEST_MODE=1&MNT_AMOUNT=120.25&MNT_TRANSACTION_ID=FF790ABCD') }
      it { is_expected.to_not be_include('MNT_SIGNATURE') }
    end

    context 'when have custom params' do
      let(:params) { { amount: '120.25', transaction_id: 'FF790ABCD', custom1: 'utm_source' } }

      it { is_expected.to eq('https://demo.moneta.ru/assistant.htm?MNT_ID=141290&MNT_CURRENCY_CODE=RUB&MNT_TEST_MODE=1&MNT_AMOUNT=120.25&MNT_TRANSACTION_ID=FF790ABCD&MNT_CUSTOM1=utm_source') }
    end

    context 'when use_signature == true' do
      let(:use_signature) { true }
      let(:params) { { amount: '120.25', transaction_id: 'FF790ABCD' } }

      it { is_expected.to be_include('MNT_SIGNATURE') }
    end

    context 'when moneta_id is override' do
      let(:params) { { amount: '120.25', transaction_id: 'FF790ABCD', moneta_id: '54321' } }

      it { is_expected.to eq('https://demo.moneta.ru/assistant.htm?MNT_ID=54321&MNT_CURRENCY_CODE=RUB&MNT_TEST_MODE=1&MNT_AMOUNT=120.25&MNT_TRANSACTION_ID=FF790ABCD') }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
payanyway-2.1.0 spec/lib/payanyway/gateway_spec.rb
payanyway-2.0.2 spec/lib/payanyway/gateway_spec.rb
payanyway-2.0.1 spec/lib/payanyway/gateway_spec.rb
payanyway-2.0.0 spec/lib/payanyway/gateway_spec.rb