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>2023-06-30 03:09:11 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-06-30 03:09:11 +0300
commit091b62a1599d0450fd6b90639a7bea9459f2afdc (patch)
tree0d644d6a4c974d30be5d6c2cfd9ee7fe247cbd43 /spec/views
parent4f1b5d2757835a204a7b882e2bea32dd8c9dfa6b (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/views')
-rw-r--r--spec/views/notify/pipeline_failed_email.html.haml_spec.rb17
-rw-r--r--spec/views/notify/pipeline_failed_email.text.erb_spec.rb55
-rw-r--r--spec/views/notify/pipeline_fixed_email.html.haml_spec.rb17
-rw-r--r--spec/views/notify/pipeline_fixed_email.text.erb_spec.rb17
-rw-r--r--spec/views/notify/pipeline_success_email.html.haml_spec.rb17
-rw-r--r--spec/views/notify/pipeline_success_email.text.erb_spec.rb17
6 files changed, 86 insertions, 54 deletions
diff --git a/spec/views/notify/pipeline_failed_email.html.haml_spec.rb b/spec/views/notify/pipeline_failed_email.html.haml_spec.rb
index defd8190eda..1623c375754 100644
--- a/spec/views/notify/pipeline_failed_email.html.haml_spec.rb
+++ b/spec/views/notify/pipeline_failed_email.html.haml_spec.rb
@@ -2,9 +2,22 @@
require 'spec_helper'
-RSpec.describe 'notify/pipeline_failed_email.html.haml' do
- it_behaves_like 'pipeline status changes email' do
+RSpec.describe 'notify/pipeline_failed_email.html.haml', feature_category: :continuous_integration do
+ context 'when pipeline has a name attribute' do
+ before do
+ build_stubbed(:ci_pipeline_metadata, pipeline: pipeline, name: "My Pipeline")
+ end
+
+ let(:title) { "Pipeline #{pipeline.name} has failed!" }
+ let(:status) { :failed }
+
+ it_behaves_like 'pipeline status changes email'
+ end
+
+ context 'when pipeline does not have a name attribute' do
let(:title) { "Pipeline ##{pipeline.id} has failed!" }
let(:status) { :failed }
+
+ it_behaves_like 'pipeline status changes email'
end
end
diff --git a/spec/views/notify/pipeline_failed_email.text.erb_spec.rb b/spec/views/notify/pipeline_failed_email.text.erb_spec.rb
index 9bd5722954f..b22a670d895 100644
--- a/spec/views/notify/pipeline_failed_email.text.erb_spec.rb
+++ b/spec/views/notify/pipeline_failed_email.text.erb_spec.rb
@@ -1,55 +1,22 @@
# frozen_string_literal: true
require 'spec_helper'
-RSpec.describe 'notify/pipeline_failed_email.text.erb' do
- include Devise::Test::ControllerHelpers
-
- let(:user) { create(:user, developer_projects: [project]) }
- let(:project) { create(:project, :repository) }
- let(:merge_request) { create(:merge_request, :simple, source_project: project) }
-
- let(:pipeline) do
- create(
- :ci_pipeline,
- :failed,
- project: project,
- user: user,
- ref: project.default_branch,
- sha: project.commit.sha
- )
- end
-
- before do
- assign(:project, project)
- assign(:pipeline, pipeline)
- assign(:merge_request, merge_request)
- end
-
- shared_examples_for 'renders the pipeline failed email correctly' do
- it 'renders the email correctly' do
- render
-
- expect(rendered).to have_content("Pipeline ##{pipeline.id} has failed!")
- expect(rendered).to have_content(pipeline.project.name)
- expect(rendered).to have_content(pipeline.git_commit_message.truncate(50).gsub(/\s+/, ' '))
- expect(rendered).to have_content(pipeline.commit.author_name)
- expect(rendered).to have_content("##{pipeline.id}")
- expect(rendered).to have_content(pipeline.user.name)
- expect(rendered).to have_content(build.id)
+RSpec.describe 'notify/pipeline_failed_email.text.erb', feature_category: :continuous_integration do
+ context 'when pipeline has a name attribute' do
+ before do
+ build_stubbed(:ci_pipeline_metadata, pipeline: pipeline, name: "My Pipeline")
end
- it_behaves_like 'correct pipeline information for pipelines for merge requests'
- end
-
- context 'when the pipeline contains a failed job' do
- let!(:build) { create(:ci_build, :failed, pipeline: pipeline, project: pipeline.project) }
+ let(:title) { "Pipeline #{pipeline.name} has failed!" }
+ let(:status) { :failed }
- it_behaves_like 'renders the pipeline failed email correctly'
+ it_behaves_like 'pipeline status changes email'
end
- context 'when the latest failed job is a bridge job' do
- let!(:build) { create(:ci_bridge, status: :failed, pipeline: pipeline, project: pipeline.project) }
+ context 'when pipeline does not have a name attribute' do
+ let(:title) { "Pipeline ##{pipeline.id} has failed!" }
+ let(:status) { :failed }
- it_behaves_like 'renders the pipeline failed email correctly'
+ it_behaves_like 'pipeline status changes email'
end
end
diff --git a/spec/views/notify/pipeline_fixed_email.html.haml_spec.rb b/spec/views/notify/pipeline_fixed_email.html.haml_spec.rb
index bdfc8fb5f6b..4c26de4650e 100644
--- a/spec/views/notify/pipeline_fixed_email.html.haml_spec.rb
+++ b/spec/views/notify/pipeline_fixed_email.html.haml_spec.rb
@@ -2,9 +2,22 @@
require 'spec_helper'
-RSpec.describe 'notify/pipeline_fixed_email.html.haml' do
- it_behaves_like 'pipeline status changes email' do
+RSpec.describe 'notify/pipeline_fixed_email.html.haml', feature_category: :continuous_integration do
+ context 'when pipeline has a name attribute' do
+ before do
+ build_stubbed(:ci_pipeline_metadata, pipeline: pipeline, name: "My Pipeline")
+ end
+
+ let(:title) { "Pipeline has been fixed and #{pipeline.name} has passed!" }
+ let(:status) { :success }
+
+ it_behaves_like 'pipeline status changes email'
+ end
+
+ context 'when pipeline does not have a name attribute' do
let(:title) { "Pipeline has been fixed and ##{pipeline.id} has passed!" }
let(:status) { :success }
+
+ it_behaves_like 'pipeline status changes email'
end
end
diff --git a/spec/views/notify/pipeline_fixed_email.text.erb_spec.rb b/spec/views/notify/pipeline_fixed_email.text.erb_spec.rb
index d0bc110f95c..dae2991b775 100644
--- a/spec/views/notify/pipeline_fixed_email.text.erb_spec.rb
+++ b/spec/views/notify/pipeline_fixed_email.text.erb_spec.rb
@@ -2,9 +2,22 @@
require 'spec_helper'
-RSpec.describe 'notify/pipeline_fixed_email.text.erb' do
- it_behaves_like 'pipeline status changes email' do
+RSpec.describe 'notify/pipeline_fixed_email.text.erb', feature_category: :continuous_integration do
+ context 'when pipeline has a name attribute' do
+ before do
+ build_stubbed(:ci_pipeline_metadata, pipeline: pipeline, name: "My Pipeline")
+ end
+
+ let(:title) { "Pipeline has been fixed and #{pipeline.name} has passed!" }
+ let(:status) { :success }
+
+ it_behaves_like 'pipeline status changes email'
+ end
+
+ context 'when pipeline does not have a name attribute' do
let(:title) { "Pipeline has been fixed and ##{pipeline.id} has passed!" }
let(:status) { :success }
+
+ it_behaves_like 'pipeline status changes email'
end
end
diff --git a/spec/views/notify/pipeline_success_email.html.haml_spec.rb b/spec/views/notify/pipeline_success_email.html.haml_spec.rb
index ce03f672700..d6958c5f491 100644
--- a/spec/views/notify/pipeline_success_email.html.haml_spec.rb
+++ b/spec/views/notify/pipeline_success_email.html.haml_spec.rb
@@ -2,9 +2,22 @@
require 'spec_helper'
-RSpec.describe 'notify/pipeline_success_email.html.haml' do
- it_behaves_like 'pipeline status changes email' do
+RSpec.describe 'notify/pipeline_success_email.html.haml', feature_category: :continuous_integration do
+ context 'when pipeline has a name attribute' do
+ before do
+ build_stubbed(:ci_pipeline_metadata, pipeline: pipeline, name: "My Pipeline")
+ end
+
+ let(:title) { "Pipeline #{pipeline.name} has passed!" }
+ let(:status) { :success }
+
+ it_behaves_like 'pipeline status changes email'
+ end
+
+ context 'when pipeline does not have a name attribute' do
let(:title) { "Pipeline ##{pipeline.id} has passed!" }
let(:status) { :success }
+
+ it_behaves_like 'pipeline status changes email'
end
end
diff --git a/spec/views/notify/pipeline_success_email.text.erb_spec.rb b/spec/views/notify/pipeline_success_email.text.erb_spec.rb
index 02334a48fa3..ac1ff68b81d 100644
--- a/spec/views/notify/pipeline_success_email.text.erb_spec.rb
+++ b/spec/views/notify/pipeline_success_email.text.erb_spec.rb
@@ -2,9 +2,22 @@
require 'spec_helper'
-RSpec.describe 'notify/pipeline_success_email.text.erb' do
- it_behaves_like 'pipeline status changes email' do
+RSpec.describe 'notify/pipeline_success_email.text.erb', feature_category: :continuous_integration do
+ context 'when pipeline has a name attribute' do
+ before do
+ build_stubbed(:ci_pipeline_metadata, pipeline: pipeline, name: "My Pipeline")
+ end
+
+ let(:title) { "Pipeline #{pipeline.name} has passed!" }
+ let(:status) { :success }
+
+ it_behaves_like 'pipeline status changes email'
+ end
+
+ context 'when pipeline does not have a name attribute' do
let(:title) { "Pipeline ##{pipeline.id} has passed!" }
let(:status) { :success }
+
+ it_behaves_like 'pipeline status changes email'
end
end