Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/hooks/service_hook_spec.rb')
-rw-r--r--spec/models/hooks/service_hook_spec.rb38
1 files changed, 11 insertions, 27 deletions
diff --git a/spec/models/hooks/service_hook_spec.rb b/spec/models/hooks/service_hook_spec.rb
index 2ece04c7158..e52af4a32b0 100644
--- a/spec/models/hooks/service_hook_spec.rb
+++ b/spec/models/hooks/service_hook_spec.rb
@@ -2,7 +2,17 @@
require 'spec_helper'
-RSpec.describe ServiceHook do
+RSpec.describe ServiceHook, feature_category: :integrations do
+ it_behaves_like 'a hook that does not get automatically disabled on failure' do
+ let(:hook) { create(:service_hook) }
+ let(:hook_factory) { :service_hook }
+ let(:default_factory_arguments) { {} }
+
+ def find_hooks
+ described_class.all
+ end
+ end
+
describe 'associations' do
it { is_expected.to belong_to :integration }
end
@@ -11,32 +21,6 @@ RSpec.describe ServiceHook do
it { is_expected.to validate_presence_of(:integration) }
end
- describe 'executable?' do
- let!(:hooks) do
- [
- [0, Time.current],
- [0, 1.minute.from_now],
- [1, 1.minute.from_now],
- [3, 1.minute.from_now],
- [4, nil],
- [4, 1.day.ago],
- [4, 1.minute.from_now],
- [0, nil],
- [0, 1.day.ago],
- [1, nil],
- [1, 1.day.ago],
- [3, nil],
- [3, 1.day.ago]
- ].map do |(recent_failures, disabled_until)|
- create(:service_hook, recent_failures: recent_failures, disabled_until: disabled_until)
- end
- end
-
- it 'is always true' do
- expect(hooks).to all(be_executable)
- end
- end
-
describe 'execute' do
let(:hook) { build(:service_hook) }
let(:data) { { key: 'value' } }