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 00:11:32 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-12-16 00:11:32 +0300
commit1c898dc5c10bbedf94386d917259153d73608495 (patch)
treef939cf185da9e96f7aba2200fa5ac74deffd71f9 /spec/views/projects
parent22baaecaa84003c554f35752a729331e956d7659 (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.rb33
-rw-r--r--spec/views/projects/hooks/index.html.haml_spec.rb36
2 files changed, 69 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
new file mode 100644
index 00000000000..1265334a572
--- /dev/null
+++ b/spec/views/projects/hooks/edit.html.haml_spec.rb
@@ -0,0 +1,33 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe 'projects/hooks/edit' do
+ let(:hook) { create(:project_hook, project: project) }
+
+ let_it_be_with_refind(:project) { create(:project) }
+
+ before do
+ assign :project, project
+ assign :hook, hook
+ end
+
+ it 'renders webhook page with "Recent events"' do
+ render
+
+ expect(rendered).to have_css('h4', text: _('Webhook'))
+ expect(rendered).to have_text(_('Recent events'))
+ end
+
+ context 'webhook is rate limited' do
+ before do
+ allow(hook).to receive(:rate_limited?).and_return(true)
+ end
+
+ it 'renders alert' do
+ render
+
+ expect(rendered).to have_text(s_('Webhooks|Webhook was automatically disabled'))
+ 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
new file mode 100644
index 00000000000..eb2b7334b98
--- /dev/null
+++ b/spec/views/projects/hooks/index.html.haml_spec.rb
@@ -0,0 +1,36 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe 'projects/hooks/index' do
+ let(:existing_hook) { create(:project_hook, project: project) }
+ let(:new_hook) { ProjectHook.new }
+
+ let_it_be_with_refind(:project) { create(:project) }
+
+ before do
+ assign :project, project
+ assign :hooks, [existing_hook]
+ assign :hook, new_hook
+ end
+
+ it 'renders webhooks page with "Project Hooks"' do
+ render
+
+ 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'))
+ end
+
+ context 'webhook is rate limited' do
+ before do
+ allow(existing_hook).to receive(:rate_limited?).and_return(true)
+ end
+
+ it 'renders "Disabled" badge' do
+ render
+
+ expect(rendered).to have_css('.gl-badge', text: _('Disabled'))
+ end
+ end
+end