Sha256: e0c075c619aeb1d44667139c0e0230b84c12ee3455d188344c419d7cd889f84c
Contents?: true
Size: 1.17 KB
Versions: 15
Compression:
Stored size: 1.17 KB
Contents
require 'spec_helper' describe CatarsePagarme::NotificationsController do before do PagarMe.stub(:validate_fingerprint).and_return(true) end let(:project) { create(:project, goal: 10_000, state: 'online') } let(:contribution) { create(:contribution, value: 10, project: project) } let(:credit_card) { create(:credit_card, subscription_id: '1542')} describe 'CREATE' do context "with invalid contribution" do before do PaymentEngines.stub(:find_payment).and_return(nil) post :create, { locale: :pt, id: 'abcdfg', use_route: 'catarse_pagarme' } end it "should not found the contribution" do expect(response.code.to_i).to eq(404) end end context "with valid contribution" do before do PaymentEngines.stub(:find_payment).and_return(contribution) post :create, { locale: :pt, id: contribution.id, use_route: 'catarse_pagarme' } end it "should save an extra_data into payment_notifications" do expect(contribution.payment_notifications.size).to eq(1) end it "should return 200 status" do expect(response.code.to_i).to eq(200) end end end end
Version data entries
15 entries across 15 versions & 1 rubygems