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:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-12-16 12:15:29 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-12-16 12:15:29 +0300
commit884e3abdb08566b80afd73e9b0d5a7b6c5ac33bd (patch)
tree52180b897032e8f65d24ccd0653f3580cdf39655 /spec/views/projects
parentb6ba9b92427a2ea0a80c8cdd159774d3882878ba (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/views/projects')
-rw-r--r--spec/views/projects/hooks/edit.html.haml_spec.rb25
-rw-r--r--spec/views/projects/hooks/index.html.haml_spec.rb26
2 files changed, 51 insertions, 0 deletions
diff --git a/spec/views/projects/hooks/edit.html.haml_spec.rb b/spec/views/projects/hooks/edit.html.haml_spec.rb
index 1265334a572..c4ec2149794 100644
--- a/spec/views/projects/hooks/edit.html.haml_spec.rb
+++ b/spec/views/projects/hooks/edit.html.haml_spec.rb
@@ -30,4 +30,29 @@ RSpec.describe 'projects/hooks/edit' do
expect(rendered).to have_text(s_('Webhooks|Webhook was automatically disabled'))
end
end
+
+ context 'webhook is permanently disabled' do
+ before do
+ allow(hook).to receive(:permanently_disabled?).and_return(true)
+ end
+
+ it 'renders alert' do
+ render
+
+ expect(rendered).to have_text(s_('Webhooks|Webhook failed to connect'))
+ end
+ end
+
+ context 'webhook is temporarily disabled' do
+ before do
+ allow(hook).to receive(:temporarily_disabled?).and_return(true)
+ allow(hook).to receive(:disabled_until).and_return(Time.now + 10.minutes)
+ end
+
+ it 'renders alert' do
+ render
+
+ expect(rendered).to have_text(s_('Webhooks|Webhook fails to connect'))
+ end
+ end
end
diff --git a/spec/views/projects/hooks/index.html.haml_spec.rb b/spec/views/projects/hooks/index.html.haml_spec.rb
index eb2b7334b98..0cdc3bcecb2 100644
--- a/spec/views/projects/hooks/index.html.haml_spec.rb
+++ b/spec/views/projects/hooks/index.html.haml_spec.rb
@@ -20,6 +20,8 @@ RSpec.describe 'projects/hooks/index' do
expect(rendered).to have_css('h4', text: _('Webhooks'))
expect(rendered).to have_text('Project Hooks')
expect(rendered).not_to have_css('.gl-badge', text: _('Disabled'))
+ expect(rendered).not_to have_css('.gl-badge', text: s_('Webhooks|Failed to connect'))
+ expect(rendered).not_to have_css('.gl-badge', text: s_('Webhooks|Fails to connect'))
end
context 'webhook is rate limited' do
@@ -33,4 +35,28 @@ RSpec.describe 'projects/hooks/index' do
expect(rendered).to have_css('.gl-badge', text: _('Disabled'))
end
end
+
+ context 'webhook is permanently disabled' do
+ before do
+ allow(existing_hook).to receive(:permanently_disabled?).and_return(true)
+ end
+
+ it 'renders "Failed to connect" badge' do
+ render
+
+ expect(rendered).to have_css('.gl-badge', text: s_('Webhooks|Failed to connect'))
+ end
+ end
+
+ context 'webhook is temporarily disabled' do
+ before do
+ allow(existing_hook).to receive(:temporarily_disabled?).and_return(true)
+ end
+
+ it 'renders "Fails to connect" badge' do
+ render
+
+ expect(rendered).to have_css('.gl-badge', text: s_('Webhooks|Fails to connect'))
+ end
+ end
end