Sha256: 00580711da705933bd5f5c35713adacc55bbd64cb0e3a3d73ade4df5eb7711d2

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

require 'spec_helper'

module WirecardGiropay
  describe NotificationResponse do

    def read_sample_file(file)
      File.read File.expand_path('../../../support/' + file, __FILE__)
    end

    let(:notification_success_xml) { read_sample_file 'sample_notification_success.xml' }
    let(:notification_reject_xml)  { read_sample_file 'sample_notification_rejection.xml' }

    describe '#success?' do
      context 'for a successful payment' do
        let(:response) { NotificationResponse.from_xml notification_success_xml }

        it('returns true') { expect(response.success?).to eq true }
      end

      context 'for a rejected payment' do
        let(:response) { NotificationResponse.from_xml notification_reject_xml }

        it('returns false') { expect(response.success?).to eq false }
      end
    end

    describe '#failed?' do
      context 'for a rejected payment' do
        let(:response) { NotificationResponse.from_xml notification_reject_xml }

        it('returns true') { expect(response.failed?).to eq true }
      end

      context 'for a successful payment' do
        let(:response) { NotificationResponse.from_xml notification_success_xml }

        it('returns false') { expect(response.failed?).to eq false }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wirecard_giropay-1.0.2 spec/lib/wirecard_giropay/notification_response_spec.rb