discourse/plugins/automation/spec/jobs/call_zapier_webhook_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
676 B
Ruby
Raw Normal View History

# 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