Sha256: 495b961d1cea3c3aa8f8a841aa40ff23343cc46d5542cf423b26633a8f7635f3
Contents?: true
Size: 1013 Bytes
Versions: 2
Compression:
Stored size: 1013 Bytes
Contents
# require "test_helper" module Pay class LagoWebhooksControllerTest < ActionDispatch::IntegrationTest include Pay::Engine.routes.url_helpers setup do @routes = Lago::Engine.routes end test "should handle lago post requests" do post webhooks_lago_path assert_response :bad_request end test "should parse a lago webhook" do lago_event = fake_event("lago/invoice.one_off_created") Pay::Webhooks::LagoController.any_instance.expects(:verified_event).returns(lago_event) pay_customer = pay_customers(:lago) pay_customer.update(processor_id: lago_event.dig("invoice", "customer", "external_id")) assert_difference "Pay::Webhook.count" do assert_enqueued_with(job: Pay::Webhooks::ProcessJob) do post webhooks_lago_path, params: lago_event assert_response :success end end assert_difference "Pay::Charge.count" do perform_enqueued_jobs end end end module Lago end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pay-lago-0.1.1 | test/controllers/pay/webhooks/lago_controller_test.rb |
pay-lago-0.1.0 | test/controllers/pay/webhooks/lago_controller_test.rb |