Sha256: 0dae23dc1c2b6e652e07c39672bc91d62010acb5e8726d1132c6f894ddd55ae5

Contents?: true

Size: 960 Bytes

Versions: 1

Compression:

Stored size: 960 Bytes

Contents

describe Moneta::Front::Service, vcr: true do
  let(:params) { { demo_mode: true } }

  let(:service) { described_class.new($cert, $cert_private_key, params) }

  describe '#request' do
    subject { service.request(path) }

    context 'when success request' do
      let(:path) { 'report/receipt.htm?operationId=467339&format=pdf' }

      its(:status) { is_expected.to eq 200 }
    end

    context 'when bad request' do
      let(:path) { 'report/receipt.htm' }
      its(:status) { is_expected.to eq 400 }
    end
  end

  describe '#get_receipt_pdf' do
    subject { service.get_receipt_pdf(operation_id) }

    context 'when success request' do
      let(:operation_id) { 467339 }

      it 'Must be a PDF' do
        expect(subject[0, 4]).to eq('%PDF')
      end
    end

    context 'when bad request' do
      let(:operation_id) { 'report/receipt.htm' }

      it { expect { subject }.to raise_error(Moneta::Front::HTTPException) }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
moneta-api-2.1.0 spec/lib/moneta/front/service_spec.rb