Skip to content
代码片段 群组 项目
提交 1c17dbaa 编辑于 作者: Kerri Miller's avatar Kerri Miller
浏览文件

Merge branch 'ld-speed-up-chat-notification-shared-examples' into 'master'

Optimise shared chat integration spec examples

See merge request gitlab-org/gitlab!95132
No related branches found
No related tags found
无相关合并请求
......@@ -32,8 +32,9 @@
end
describe "#execute" do
let(:user) { create(:user) }
let(:project) { create(:project, :repository) }
let_it_be(:user) { create(:user) }
let_it_be_with_reload(:project) { create(:project, :repository) }
let(:webhook_url) { "https://example.gitlab.com/" }
before do
......@@ -112,14 +113,14 @@
end
context "with protected branch" do
before do
create(:protected_branch, :create_branch_on_repository, project: project, name: "a-protected-branch")
end
let(:sample_data) do
Gitlab::DataBuilder::Push.build(project: project, user: user, ref: "a-protected-branch")
end
before_all do
create(:protected_branch, :create_branch_on_repository, project: project, name: "a-protected-branch")
end
context "when only default branch are to be notified" do
it_behaves_like "untriggered #{integration_name} integration", branches_to_be_notified: "default"
end
......@@ -214,7 +215,7 @@
let(:sample_data) { Gitlab::DataBuilder::Note.build(note, user) }
context "with commit comment" do
let(:note) do
let_it_be(:note) do
create(:note_on_commit,
author: user,
project: project,
......@@ -226,7 +227,7 @@
end
context "with merge request comment" do
let(:note) do
let_it_be(:note) do
create(:note_on_merge_request, project: project, note: "merge request note")
end
......@@ -234,7 +235,7 @@
end
context "with issue comment" do
let(:note) do
let_it_be(:note) do
create(:note_on_issue, project: project, note: "issue note")
end
......@@ -242,7 +243,7 @@
end
context "with snippet comment" do
let(:note) do
let_it_be(:note) do
create(:note_on_project_snippet, project: project, note: "snippet note")
end
......@@ -251,22 +252,24 @@
end
context "with pipeline events" do
let(:pipeline) do
create(:ci_pipeline,
project: project, status: status,
sha: project.commit.sha, ref: project.default_branch)
end
let(:sample_data) { Gitlab::DataBuilder::Pipeline.build(pipeline) }
context "with failed pipeline" do
let(:status) { "failed" }
let_it_be(:pipeline) do
create(:ci_pipeline,
project: project, status: "failed",
sha: project.commit.sha, ref: project.default_branch)
end
it_behaves_like "triggered #{integration_name} integration"
end
context "with succeeded pipeline" do
let(:status) { "success" }
let_it_be(:pipeline) do
create(:ci_pipeline,
project: project, status: "success",
sha: project.commit.sha, ref: project.default_branch)
end
context "with default notify_only_broken_pipelines" do
it "does not call #{integration_name} API" do
......@@ -308,7 +311,7 @@
end
context "with protected branch" do
before do
before_all do
create(:protected_branch, :create_branch_on_repository, project: project, name: "a-protected-branch")
end
......@@ -357,7 +360,8 @@
end
context 'deployment events' do
let(:deployment) { create(:deployment) }
let_it_be(:deployment) { create(:deployment) }
let(:sample_data) { Gitlab::DataBuilder::Deployment.build(deployment, deployment.status, Time.now) }
it_behaves_like "untriggered #{integration_name} integration"
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册