Sha256: 10c6922edb5e0d53a2fdb8228f97bf757b2274d5d6530c9079f6c5fb94d0318e
Contents?: true
Size: 981 Bytes
Versions: 5
Compression:
Stored size: 981 Bytes
Contents
require 'spec_helper' module Spree describe MercadoPagoController do describe "#ipn" do let(:operation_id) { "op123" } describe "for valid notifications" do let(:use_case) { double("use_case") } it "handles notification and returns success" do MercadoPago::HandleReceivedNotification.should_receive(:new).and_return(use_case) use_case.should_receive(:process!) spree_post :ipn, { id: operation_id, topic: "payment" } response.should be_success notification = ::MercadoPago::Notification.order(:created_at).last notification.topic.should eq("payment") notification.operation_id.should eq(operation_id) end end describe "for invalid notification" do it "responds with invalid request" do spree_post :ipn, { id: operation_id, topic: "nonexistent_topic" } response.should be_bad_request end end end end end
Version data entries
5 entries across 5 versions & 2 rubygems