summaryrefslogtreecommitdiff
path: root/spec/models/hooks/system_hook_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/hooks/system_hook_spec.rb')
-rw-r--r--spec/models/hooks/system_hook_spec.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/models/hooks/system_hook_spec.rb b/spec/models/hooks/system_hook_spec.rb
index a99263078b3..17cb5da977a 100644
--- a/spec/models/hooks/system_hook_spec.rb
+++ b/spec/models/hooks/system_hook_spec.rb
@@ -16,6 +16,21 @@ RSpec.describe SystemHook do
end
end
+ describe 'validations' do
+ describe 'url' do
+ let(:url) { 'http://localhost:9000' }
+
+ it { is_expected.not_to allow_value(url).for(:url) }
+
+ it 'is valid if application settings allow local requests from system hooks' do
+ settings = ApplicationSetting.new(allow_local_requests_from_system_hooks: true)
+ allow(ApplicationSetting).to receive(:current).and_return(settings)
+
+ is_expected.to allow_value(url).for(:url)
+ end
+ end
+ end
+
describe "execute", :sidekiq_might_not_need_inline do
let(:system_hook) { create(:system_hook) }
let(:user) { create(:user) }