mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-13 04:00:21 +00:00
Add button to send test data to endpoint
It will allow a user to easily test the endpoint
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user