Sha256: 70035180efe11e288b8000898357c509d9ded6d6751d04e34532d0a5b53a6ea2

Contents?: true

Size: 1.27 KB

Versions: 6

Compression:

Stored size: 1.27 KB

Contents

require "spec_helper"

describe PagSeguro::Notification do
  let(:code) { '766B9C-AD4B044B04DA-77742F5FA653-E1AB24' }
  let(:type) { 'transaction' }

  let(:notification) { PagSeguro::Notification.new(code, type) }
  subject { notification  }

  it { should respond_to(:transaction) }

  before do
    PagSeguro.email = 'mail'
    PagSeguro.token = 'token'
    PagSeguro.alt_email = 'alt_mail'
    PagSeguro.alt_token = 'alt_token'
  end

  describe "#transaction" do
    context "with default credencials" do
      subject { notification.transaction  }
      before do
        stub_request(:get, "https://ws.pagseguro.uol.com.br/v2/transactions/notifications/766B9C-AD4B044B04DA-77742F5FA653-E1AB24?email=mail&token=token").
         to_return(:status => 200, :body => "", :headers => {})
      end

      it { should be_a_kind_of(PagSeguro::Transaction) }
    end

    context "with secondary credencials" do
      subject { notification.transaction("alternative")  }
      before do
        stub_request(:get, "https://ws.pagseguro.uol.com.br/v2/transactions/notifications/766B9C-AD4B044B04DA-77742F5FA653-E1AB24?email=alt_mail&token=alt_token").
         to_return(:status => 200, :body => "", :headers => {})
      end

      it { should be_a_kind_of(PagSeguro::Transaction) }
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pagseguro-transparente-0.2.5 spec/pagseguro/notification_spec.rb
pagseguro-transparente-0.2.4 spec/pagseguro/notification_spec.rb
pagseguro-transparente-0.2.3 spec/pagseguro/notification_spec.rb
pagseguro-transparente-0.2.2 spec/pagseguro/notification_spec.rb
pagseguro-transparente-0.2.1 spec/pagseguro/notification_spec.rb
pagseguro-transparente-0.2.0 spec/pagseguro/notification_spec.rb