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/views/shared')
-rw-r--r--spec/views/shared/runners/_runner_details.html.haml_spec.rb4
-rw-r--r--spec/views/shared/web_hooks/_web_hook_disabled_alert.html.haml_spec.rb38
2 files changed, 40 insertions, 2 deletions
diff --git a/spec/views/shared/runners/_runner_details.html.haml_spec.rb b/spec/views/shared/runners/_runner_details.html.haml_spec.rb
index cdf5ec563d0..978750c8435 100644
--- a/spec/views/shared/runners/_runner_details.html.haml_spec.rb
+++ b/spec/views/shared/runners/_runner_details.html.haml_spec.rb
@@ -113,14 +113,14 @@ RSpec.describe 'shared/runners/_runner_details.html.haml' do
describe 'Tags value' do
context 'when runner does not have tags' do
it { is_expected.to have_content('Tags') }
- it { is_expected.not_to have_selector('span.gl-badge.badge.badge-info')}
+ it { is_expected.not_to have_selector('span.gl-badge.badge.badge-info') }
end
context 'when runner have tags' do
let(:runner) { create(:ci_runner, tag_list: %w(tag2 tag3 tag1)) }
it { is_expected.to have_content('Tags tag1 tag2 tag3') }
- it { is_expected.to have_selector('span.gl-badge.badge.badge-info')}
+ it { is_expected.to have_selector('span.gl-badge.badge.badge-info') }
end
end
diff --git a/spec/views/shared/web_hooks/_web_hook_disabled_alert.html.haml_spec.rb b/spec/views/shared/web_hooks/_web_hook_disabled_alert.html.haml_spec.rb
new file mode 100644
index 00000000000..22ed8bb262c
--- /dev/null
+++ b/spec/views/shared/web_hooks/_web_hook_disabled_alert.html.haml_spec.rb
@@ -0,0 +1,38 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe 'shared/web_hooks/_web_hook_disabled_alert' do
+ let_it_be(:project) { create(:project) }
+
+ let(:show_project_hook_failed_callout?) { false }
+
+ def after_flash_content
+ view.content_for(:after_flash_content)
+ end
+
+ before do
+ assign(:project, project)
+ allow(view).to receive(:show_project_hook_failed_callout?).and_return(show_project_hook_failed_callout?)
+ end
+
+ context 'when show_project_hook_failed_callout? is true' do
+ let(:show_project_hook_failed_callout?) { true }
+
+ it 'adds alert to `:after_flash_content`' do
+ render
+
+ expect(after_flash_content).to have_content('Webhook disabled')
+ end
+ end
+
+ context 'when show_project_hook_failed_callout? is false' do
+ it 'does not add alert to `:after_flash_content`' do
+ # We have to use `view.render` because `render` causes issues
+ # https://github.com/rails/rails/issues/41320
+ view.render('shared/web_hooks/web_hook_disabled_alert')
+
+ expect(after_flash_content).to be_nil
+ end
+ end
+end