discourse/plugins/automation/spec/jobs/call_zapier_webhook_spec.rb
Osama Sayegh 3d4faf3272
FEATURE: Merge discourse-automation (#26432)
Automation (previously known as discourse-automation) is now a core plugin.
2024-04-03 18:20:43 +03:00

29 lines
676 B
Ruby

# frozen_string_literal: true
require_relative "../discourse_automation_helper"
describe Jobs::DiscourseAutomationCallZapierWebhook do
before do
SiteSetting.discourse_automation_enabled = true
freeze_time
Jobs.run_immediately!
stub_request(:post, "https://foo.com/").with(
body: "null",
headers: {
"Host" => "foo.com",
},
).to_return(status: 200, body: "", headers: {})
end
it "is rate limited" do
RateLimiter.enable
expect do
6.times do
Jobs.enqueue(:discourse_automation_call_zapier_webhook, webhook_url: "https://foo.com")
end
end.to raise_error(RateLimiter::LimitExceeded)
end
end