Add button to send test data to endpoint

It will allow a user to easily test the endpoint
This commit is contained in:
Gaetan Craig-Riou
2025-12-02 16:05:44 +11:00
parent 72085be896
commit 5e4df41ec8
6 changed files with 86 additions and 4 deletions

View File

@@ -69,4 +69,22 @@ RSpec.describe WebhookEndpointsController do
expect(response).to redirect_to "/account#/developer_settings"
end
end
describe "#test" do
let(:webhook_endpoint) {
user.webhook_endpoints.create(url: "https://url", webhook_type: "payment_status_changed" )
}
subject { spree_post :test, id: webhook_endpoint.id, format: :turbo_stream }
it "enqueus a webhook job" do
expect { subject }.to enqueue_job(WebhookDeliveryJob).exactly(1).times
end
it "shows a success mesage" do
subject
expect(flash[:success]).to eq "Some test data has been sent to the webhook url"
end
end
end