Sha256: cb8731336f7cd711b14f3640ee86d825db7a4fe67b800c7f5c1ebe44a926241d
Contents?: true
Size: 1.8 KB
Versions: 1
Compression:
Stored size: 1.8 KB
Contents
require "spec_helper" include PayPal::AdaptivePayments describe PayPal::AdaptivePayments::Payment do let(:preapproval_key) { 'PA-89578182UL033944H' } let(:receiver_email) { 'chardy_1345003248_per@gmail.com' } let(:receiver) { Receiver.new(:email => receiver_email, :amount => 10.0) } let(:receiver_list) { ReceiverList.new(:receivers => [receiver]) } describe "#create" do context "when successful" do use_vcr_cassette "adaptive_payments/payment/create/success"#, :record => :all let(:payment) { PayPal::AdaptivePayments::Payment.new( :receiver => receiver, :preapproval_key => preapproval_key, :currency_code => 'USD', :cancel_url => 'http://example.com/cancel', :return_url => 'http://example.com/thank_you' ) } subject { payment.create } before { subject } it "sets action_type to :create" do payment.action_type.should eql('CREATE') end it "sets the pay_key" do payment.pay_key.should_not be_nil end its(:success?) { should be_true } its(:valid?) { should be_true } its(:payment_url) { should eql("https://www.sandbox.paypal.com/webscr?cmd=_ap-payment&paykey=#{payment.pay_key}") } end context "when failure" do use_vcr_cassette "adaptive_payments/payment/create/failure"#, :record => :all let(:payment) { PayPal::AdaptivePayments::Payment.new( :receiver => receiver, :currency_code => 'USD', :cancel_url => 'example.com/cancel', :return_url => 'http://example.com/thank_you' ) } subject { payment.create } before { subject } its(:success?) { should be_false } its(:valid?) { should be_false } its(:errors) { should have(1).item } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
paypal-payment-0.1.2 | spec/paypal/adaptive_payments/payment/create_spec.rb |