Sha256: b955ee8f75488b9f0122f5831e3c974aaeaffeddabc8c2141f6451570a4acf5d

Contents?: true

Size: 1.28 KB

Versions: 14

Compression:

Stored size: 1.28 KB

Contents

describe Moneta::Api::Service do
  let(:params) { { demo_mode: true } }
  let(:service) { described_class.new($username, $password, params) }

  describe '#find_account_by_id', vcr: true do
    subject { service.find_account_by_id(account_id) }

    context 'when success response' do
      let(:account_id) { 10999 }

      its('account.id') { is_expected.to eq '10999' }
    end

    context 'when soap raise error' do
      let(:account_id) { -1 }

      it { expect { subject }.to raise_exception(Moneta::Api::RuntimeException, 'Validation error') }
    end

    context 'when soap http error' do
      let(:account_id) { -2 }

      it { expect { subject }.to raise_exception(Moneta::Api::HTTPException) }
    end
  end

  describe 'wsdl url' do
    subject{ service.client.globals.instance_variable_get('@options')[:wsdl] }

    context 'when demo mode' do
      it { is_expected.to eq 'https://demo.moneta.ru/services.wsdl' }
    end

    context 'when demo mode' do
      let(:params) { {} }

      it { is_expected.to eq 'https://www.moneta.ru/services.wsdl' }
    end
  end

  describe 'request validate' do
    it { expect { service.authorise_transaction('invalid request') }.to raise_exception(TypeError, "String can't be coerced into Moneta::Api::Requests::AuthoriseTransactionRequest") }
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
moneta-api-1.13.0 spec/lib/moneta/api/service_spec.rb
moneta-api-1.12.8 spec/lib/moneta/api/service_spec.rb
moneta-api-1.12.7 spec/lib/moneta/api/service_spec.rb
moneta-api-1.12.6 spec/lib/moneta/api/service_spec.rb
moneta-api-1.12.5 spec/lib/moneta/api/service_spec.rb
moneta-api-1.12.4 spec/lib/moneta/api/service_spec.rb
moneta-api-1.12.3 spec/lib/moneta/api/service_spec.rb
moneta-api-1.12.2 spec/lib/moneta/api/service_spec.rb
moneta-api-1.12.1 spec/lib/moneta/api/service_spec.rb
moneta-api-1.12.0 spec/lib/moneta/api/service_spec.rb
moneta-api-1.11.0 spec/lib/moneta/api/service_spec.rb
moneta-api-1.10.0 spec/lib/moneta/api/service_spec.rb
moneta-api-1.9.0 spec/lib/moneta/api/service_spec.rb
moneta-api-1.8.0 spec/lib/moneta/api/service_spec.rb