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>2022-07-20 18:40:28 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-07-20 18:40:28 +0300
commitb595cb0c1dec83de5bdee18284abe86614bed33b (patch)
tree8c3d4540f193c5ff98019352f554e921b3a41a72 /spec/serializers
parent2f9104a328fc8a4bddeaa4627b595166d24671d0 (diff)
Add latest changes from gitlab-org/gitlab@15-2-stable-eev15.2.0-rc42
Diffstat (limited to 'spec/serializers')
-rw-r--r--spec/serializers/ci/dag_job_group_entity_spec.rb6
-rw-r--r--spec/serializers/ci/dag_pipeline_entity_spec.rb6
-rw-r--r--spec/serializers/ci/dag_stage_entity_spec.rb4
-rw-r--r--spec/serializers/ci/job_entity_spec.rb8
-rw-r--r--spec/serializers/ci/job_serializer_spec.rb32
-rw-r--r--spec/serializers/cluster_entity_spec.rb60
-rw-r--r--spec/serializers/cluster_serializer_spec.rb2
-rw-r--r--spec/serializers/diffs_entity_spec.rb1
-rw-r--r--spec/serializers/diffs_metadata_entity_spec.rb1
-rw-r--r--spec/serializers/environment_entity_spec.rb48
-rw-r--r--spec/serializers/integrations/field_entity_spec.rb2
-rw-r--r--spec/serializers/integrations/harbor_serializers/artifact_entity_spec.rb51
-rw-r--r--spec/serializers/integrations/harbor_serializers/artifact_serializer_spec.rb9
-rw-r--r--spec/serializers/integrations/harbor_serializers/repository_entity_spec.rb55
-rw-r--r--spec/serializers/integrations/harbor_serializers/repository_serializer_spec.rb9
-rw-r--r--spec/serializers/integrations/harbor_serializers/tag_entity_spec.rb38
-rw-r--r--spec/serializers/integrations/harbor_serializers/tag_serializer_spec.rb9
-rw-r--r--spec/serializers/issue_entity_spec.rb2
-rw-r--r--spec/serializers/member_user_entity_spec.rb4
-rw-r--r--spec/serializers/paginated_diff_entity_spec.rb1
-rw-r--r--spec/serializers/stage_entity_spec.rb10
-rw-r--r--spec/serializers/stage_serializer_spec.rb4
-rw-r--r--spec/serializers/test_reports_comparer_entity_spec.rb4
-rw-r--r--spec/serializers/test_reports_comparer_serializer_spec.rb4
24 files changed, 205 insertions, 165 deletions
diff --git a/spec/serializers/ci/dag_job_group_entity_spec.rb b/spec/serializers/ci/dag_job_group_entity_spec.rb
index 5a75c04efe5..b654b21f583 100644
--- a/spec/serializers/ci/dag_job_group_entity_spec.rb
+++ b/spec/serializers/ci/dag_job_group_entity_spec.rb
@@ -14,7 +14,7 @@ RSpec.describe Ci::DagJobGroupEntity do
subject { entity.as_json }
context 'when group contains 1 job' do
- let(:job) { create(:ci_build, stage: stage, pipeline: pipeline, name: 'test') }
+ let(:job) { create(:ci_build, stage_id: stage.id, pipeline: pipeline, name: 'test') }
let(:jobs) { [job] }
it 'exposes a name' do
@@ -38,8 +38,8 @@ RSpec.describe Ci::DagJobGroupEntity do
end
context 'when group contains multiple parallel jobs' do
- let(:job_1) { create(:ci_build, stage: stage, pipeline: pipeline, name: 'test 1/2') }
- let(:job_2) { create(:ci_build, stage: stage, pipeline: pipeline, name: 'test 2/2') }
+ let(:job_1) { create(:ci_build, stage_id: stage.id, pipeline: pipeline, name: 'test 1/2') }
+ let(:job_2) { create(:ci_build, stage_id: stage.id, pipeline: pipeline, name: 'test 2/2') }
let(:jobs) { [job_1, job_2] }
it 'exposes a name' do
diff --git a/spec/serializers/ci/dag_pipeline_entity_spec.rb b/spec/serializers/ci/dag_pipeline_entity_spec.rb
index 31a0dc5c048..548fd247743 100644
--- a/spec/serializers/ci/dag_pipeline_entity_spec.rb
+++ b/spec/serializers/ci/dag_pipeline_entity_spec.rb
@@ -43,9 +43,9 @@ RSpec.describe Ci::DagPipelineEntity do
end
context 'when pipeline has parallel jobs, DAG needs and GenericCommitStatus' do
- let!(:stage_build) { create(:ci_stage_entity, name: 'build', position: 1, pipeline: pipeline) }
- let!(:stage_test) { create(:ci_stage_entity, name: 'test', position: 2, pipeline: pipeline) }
- let!(:stage_deploy) { create(:ci_stage_entity, name: 'deploy', position: 3, pipeline: pipeline) }
+ let!(:stage_build) { create(:ci_stage, name: 'build', position: 1, pipeline: pipeline) }
+ let!(:stage_test) { create(:ci_stage, name: 'test', position: 2, pipeline: pipeline) }
+ let!(:stage_deploy) { create(:ci_stage, name: 'deploy', position: 3, pipeline: pipeline) }
let!(:job_build_1) { create(:ci_build, name: 'build 1', stage: 'build', pipeline: pipeline) }
let!(:job_build_2) { create(:ci_build, name: 'build 2', stage: 'build', pipeline: pipeline) }
diff --git a/spec/serializers/ci/dag_stage_entity_spec.rb b/spec/serializers/ci/dag_stage_entity_spec.rb
index 0262ccdac68..3530a5e2bae 100644
--- a/spec/serializers/ci/dag_stage_entity_spec.rb
+++ b/spec/serializers/ci/dag_stage_entity_spec.rb
@@ -6,10 +6,10 @@ RSpec.describe Ci::DagStageEntity do
let_it_be(:pipeline) { create(:ci_pipeline) }
let_it_be(:request) { double(:request) }
- let(:stage) { build(:ci_stage, pipeline: pipeline, name: 'test') }
+ let(:stage) { create(:ci_stage, pipeline: pipeline, name: 'test') }
let(:entity) { described_class.new(stage, request: request) }
- let!(:job) { create(:ci_build, :success, pipeline: pipeline) }
+ let!(:job) { create(:ci_build, :success, pipeline: pipeline, stage_id: stage.id) }
describe '#as_json' do
subject { entity.as_json }
diff --git a/spec/serializers/ci/job_entity_spec.rb b/spec/serializers/ci/job_entity_spec.rb
index 05b9e38444c..174d9a0aadb 100644
--- a/spec/serializers/ci/job_entity_spec.rb
+++ b/spec/serializers/ci/job_entity_spec.rb
@@ -52,6 +52,14 @@ RSpec.describe Ci::JobEntity do
expect(subject[:status]).to include :icon, :favicon, :text, :label, :tooltip
end
+ it 'contains queued_at' do
+ expect(subject).to include :queued_at
+ end
+
+ it 'contains queued_duration' do
+ expect(subject).to include :queued_duration
+ end
+
context 'when job is retryable' do
before do
job.update!(status: :failed)
diff --git a/spec/serializers/ci/job_serializer_spec.rb b/spec/serializers/ci/job_serializer_spec.rb
index d47c9fdbf24..5f889a10f3d 100644
--- a/spec/serializers/ci/job_serializer_spec.rb
+++ b/spec/serializers/ci/job_serializer_spec.rb
@@ -28,36 +28,4 @@ RSpec.describe Ci::JobSerializer do
end
end
end
-
- describe '#represent_status' do
- context 'for a failed build' do
- let(:resource) { create(:ci_build, :failed) }
- let(:status) { resource.detailed_status(double('user')) }
-
- subject { serializer.represent_status(resource) }
-
- it 'serializes only status' do
- expect(subject[:text]).to eq(status.text)
- expect(subject[:label]).to eq('failed')
- expect(subject[:tooltip]).to eq('failed - (unknown failure)')
- expect(subject[:icon]).to eq(status.icon)
- expect(subject[:favicon]).to match_asset_path("/assets/ci_favicons/#{status.favicon}.png")
- end
- end
-
- context 'for any other type of build' do
- let(:resource) { create(:ci_build, :success) }
- let(:status) { resource.detailed_status(double('user')) }
-
- subject { serializer.represent_status(resource) }
-
- it 'serializes only status' do
- expect(subject[:text]).to eq(status.text)
- expect(subject[:label]).to eq('passed')
- expect(subject[:tooltip]).to eq('passed')
- expect(subject[:icon]).to eq(status.icon)
- expect(subject[:favicon]).to match_asset_path("/assets/ci_favicons/#{status.favicon}.png")
- end
- end
- end
end
diff --git a/spec/serializers/cluster_entity_spec.rb b/spec/serializers/cluster_entity_spec.rb
index 514828e3c69..7c4c146575d 100644
--- a/spec/serializers/cluster_entity_spec.rb
+++ b/spec/serializers/cluster_entity_spec.rb
@@ -55,65 +55,5 @@ RSpec.describe ClusterEntity do
expect(helm[:status]).to eq(:not_installable)
end
end
-
- context 'gitlab_managed_apps_logs_path' do
- let(:cluster) { create(:cluster, :project) }
- let(:user) { create(:user) }
-
- subject { described_class.new(cluster, request: request).as_json }
-
- before do
- allow_next_instance_of(Clusters::ClusterPresenter) do |presenter|
- allow(presenter).to receive(:show_path).and_return(nil)
- end
- end
-
- it 'return projects log explorer path' do
- log_explorer_path = project_logs_path(cluster.project, cluster_id: cluster.id)
-
- expect_next_instance_of(Clusters::ClusterPresenter, cluster, current_user: user) do |presenter|
- expect(presenter).to receive(:gitlab_managed_apps_logs_path).and_return(log_explorer_path)
- end
-
- expect(subject[:gitlab_managed_apps_logs_path]).to eq(log_explorer_path)
- end
-
- context 'when feature is disabled' do
- before do
- stub_feature_flags(monitor_logging: false)
- end
-
- specify { is_expected.not_to include(:gitlab_managed_apps_logs_path) }
- end
- end
-
- context 'enable_advanced_logs_querying' do
- let(:cluster) { create(:cluster, :project) }
- let(:user) { create(:user) }
-
- subject { described_class.new(cluster, request: request).as_json }
-
- context 'elastic stack is not installed on cluster' do
- it 'returns false' do
- expect(subject[:enable_advanced_logs_querying]).to be false
- end
- end
-
- context 'elastic stack is enabled on cluster' do
- it 'returns true' do
- create(:clusters_integrations_elastic_stack, cluster: cluster)
-
- expect(subject[:enable_advanced_logs_querying]).to be true
- end
- end
-
- context 'when feature is disabled' do
- before do
- stub_feature_flags(monitor_logging: false)
- end
-
- specify { is_expected.not_to include(:enable_advanced_logs_querying) }
- end
- end
end
end
diff --git a/spec/serializers/cluster_serializer_spec.rb b/spec/serializers/cluster_serializer_spec.rb
index e65e97b6ae0..7ec6d3c8bb8 100644
--- a/spec/serializers/cluster_serializer_spec.rb
+++ b/spec/serializers/cluster_serializer_spec.rb
@@ -14,8 +14,6 @@ RSpec.describe ClusterSerializer do
:enabled,
:environment_scope,
:id,
- :gitlab_managed_apps_logs_path,
- :enable_advanced_logs_querying,
:kubernetes_errors,
:name,
:nodes,
diff --git a/spec/serializers/diffs_entity_spec.rb b/spec/serializers/diffs_entity_spec.rb
index aef7d3732f8..72777bde30c 100644
--- a/spec/serializers/diffs_entity_spec.rb
+++ b/spec/serializers/diffs_entity_spec.rb
@@ -100,6 +100,7 @@ RSpec.describe DiffsEntity do
let(:options) { super().merge(merge_ref_head_diff: merge_ref_head_diff) }
before do
+ allow(merge_request).to receive(:cannot_be_merged?).and_return(true)
allow(MergeRequests::Conflicts::ListService).to receive(:new).and_return(conflicts)
end
diff --git a/spec/serializers/diffs_metadata_entity_spec.rb b/spec/serializers/diffs_metadata_entity_spec.rb
index 3311b434ce5..0e3d808aaac 100644
--- a/spec/serializers/diffs_metadata_entity_spec.rb
+++ b/spec/serializers/diffs_metadata_entity_spec.rb
@@ -65,6 +65,7 @@ RSpec.describe DiffsMetadataEntity do
let(:conflicts) { double(conflicts: double(files: [conflict_file]), can_be_resolved_in_ui?: false) }
before do
+ allow(merge_request).to receive(:cannot_be_merged?).and_return(true)
allow(MergeRequests::Conflicts::ListService).to receive(:new).and_return(conflicts)
end
diff --git a/spec/serializers/environment_entity_spec.rb b/spec/serializers/environment_entity_spec.rb
index 9b6a293da16..cbe32600941 100644
--- a/spec/serializers/environment_entity_spec.rb
+++ b/spec/serializers/environment_entity_spec.rb
@@ -133,54 +133,6 @@ RSpec.describe EnvironmentEntity do
end
end
- context 'pod_logs' do
- context 'with reporter access' do
- before do
- project.add_reporter(user)
- end
-
- it 'does not expose logs keys' do
- expect(subject).not_to include(:logs_path)
- expect(subject).not_to include(:logs_api_path)
- expect(subject).not_to include(:enable_advanced_logs_querying)
- end
- end
-
- context 'with developer access' do
- before do
- project.add_developer(user)
- end
-
- it 'exposes logs keys' do
- expect(subject).to include(:logs_path)
- expect(subject).to include(:logs_api_path)
- expect(subject).to include(:enable_advanced_logs_querying)
- end
-
- it 'uses k8s api when ES is not available' do
- expect(subject[:logs_api_path]).to eq(k8s_project_logs_path(project, environment_name: environment.name, format: :json))
- end
-
- it 'uses ES api when ES is available' do
- allow(environment).to receive(:elastic_stack_available?).and_return(true)
-
- expect(subject[:logs_api_path]).to eq(elasticsearch_project_logs_path(project, environment_name: environment.name, format: :json))
- end
-
- context 'with feature flag disabled' do
- before do
- stub_feature_flags(monitor_logging: false)
- end
-
- it 'does not expose logs keys' do
- expect(subject).not_to include(:logs_path)
- expect(subject).not_to include(:logs_api_path)
- expect(subject).not_to include(:enable_advanced_logs_querying)
- end
- end
- end
- end
-
context 'with deployment service ready' do
before do
allow(environment).to receive(:has_terminals?).and_return(true)
diff --git a/spec/serializers/integrations/field_entity_spec.rb b/spec/serializers/integrations/field_entity_spec.rb
index e75dc051f5e..7af17cf6df6 100644
--- a/spec/serializers/integrations/field_entity_spec.rb
+++ b/spec/serializers/integrations/field_entity_spec.rb
@@ -114,6 +114,6 @@ RSpec.describe Integrations::FieldEntity do
end
def integration_field(name)
- integration.global_fields.find { |f| f[:name] == name }
+ integration.form_fields.find { |f| f[:name] == name }
end
end
diff --git a/spec/serializers/integrations/harbor_serializers/artifact_entity_spec.rb b/spec/serializers/integrations/harbor_serializers/artifact_entity_spec.rb
new file mode 100644
index 00000000000..c9a95c02e19
--- /dev/null
+++ b/spec/serializers/integrations/harbor_serializers/artifact_entity_spec.rb
@@ -0,0 +1,51 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Integrations::HarborSerializers::ArtifactEntity do
+ let_it_be(:harbor_integration) { create(:harbor_integration) }
+
+ let(:artifact) do
+ {
+ "digest": "sha256:14d4f50961544fdb669075c442509f194bdc4c0e344bde06e35dbd55af842a38",
+ "id": 5,
+ "project_id": 14,
+ "push_time": "2022-03-22T09:04:56.170Z",
+ "repository_id": 5,
+ "size": 774790,
+ "tags": [
+ {
+ "artifact_id": 5,
+ "id": 7,
+ "immutable": false,
+ "name": "2",
+ "push_time": "2022-03-22T09:05:04.844Z",
+ "repository_id": 5,
+ "signed": false
+ },
+ {
+ "artifact_id": 5,
+ "id": 6,
+ "immutable": false,
+ "name": "1",
+ "push_time": "2022-03-22T09:04:56.186Z",
+ "repository_id": 5,
+ "signed": false
+ }
+ ],
+ "type": "IMAGE"
+ }.deep_stringify_keys
+ end
+
+ subject { described_class.new(artifact).as_json }
+
+ it 'returns the Harbor artifact' do
+ expect(subject).to include({
+ harbor_id: 5,
+ size: 774790,
+ push_time: "2022-03-22T09:04:56.170Z".to_datetime,
+ digest: "sha256:14d4f50961544fdb669075c442509f194bdc4c0e344bde06e35dbd55af842a38",
+ tags: %w[2 1]
+ })
+ end
+end
diff --git a/spec/serializers/integrations/harbor_serializers/artifact_serializer_spec.rb b/spec/serializers/integrations/harbor_serializers/artifact_serializer_spec.rb
new file mode 100644
index 00000000000..9879c0a6434
--- /dev/null
+++ b/spec/serializers/integrations/harbor_serializers/artifact_serializer_spec.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Integrations::HarborSerializers::ArtifactSerializer do
+ it 'represents Integrations::HarborSerializers::ArtifactEntity entities' do
+ expect(described_class.entity_class).to eq(Integrations::HarborSerializers::ArtifactEntity)
+ end
+end
diff --git a/spec/serializers/integrations/harbor_serializers/repository_entity_spec.rb b/spec/serializers/integrations/harbor_serializers/repository_entity_spec.rb
new file mode 100644
index 00000000000..29708bd0416
--- /dev/null
+++ b/spec/serializers/integrations/harbor_serializers/repository_entity_spec.rb
@@ -0,0 +1,55 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Integrations::HarborSerializers::RepositoryEntity do
+ let_it_be(:harbor_integration) { create(:harbor_integration) }
+
+ let(:repo) do
+ {
+ "artifact_count" => 1,
+ "creation_time" => "2022-03-13T09:36:43.240Z",
+ "id" => 1,
+ "name" => "jihuprivate/busybox",
+ "project_id" => 4,
+ "pull_count" => 0,
+ "update_time" => "2022-03-13T09:36:43.240Z"
+ }.deep_stringify_keys
+ end
+
+ subject { described_class.new(repo, url: "https://demo.goharbor.io", project_name: "jihuprivate").as_json }
+
+ context 'with normal repository data' do
+ it 'returns the Harbor repository' do
+ expect(subject).to include({
+ artifact_count: 1,
+ creation_time: "2022-03-13T09:36:43.240Z".to_datetime,
+ harbor_id: 1,
+ name: "jihuprivate/busybox",
+ harbor_project_id: 4,
+ pull_count: 0,
+ update_time: "2022-03-13T09:36:43.240Z".to_datetime,
+ location: "https://demo.goharbor.io/harbor/projects/4/repositories/busybox"
+ })
+ end
+ end
+
+ context 'with data that may contain path traversal attacks' do
+ before do
+ repo["project_id"] = './../../../../../etc/hosts'
+ end
+
+ it 'returns empty location' do
+ expect(subject).to include({
+ artifact_count: 1,
+ creation_time: "2022-03-13T09:36:43.240Z".to_datetime,
+ harbor_id: 1,
+ name: "jihuprivate/busybox",
+ harbor_project_id: './../../../../../etc/hosts',
+ pull_count: 0,
+ update_time: "2022-03-13T09:36:43.240Z".to_datetime,
+ location: "https://demo.goharbor.io/"
+ })
+ end
+ end
+end
diff --git a/spec/serializers/integrations/harbor_serializers/repository_serializer_spec.rb b/spec/serializers/integrations/harbor_serializers/repository_serializer_spec.rb
new file mode 100644
index 00000000000..1a4235bea1e
--- /dev/null
+++ b/spec/serializers/integrations/harbor_serializers/repository_serializer_spec.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Integrations::HarborSerializers::RepositorySerializer do
+ it 'represents Integrations::HarborSerializers::RepositoryEntity entities' do
+ expect(described_class.entity_class).to eq(Integrations::HarborSerializers::RepositoryEntity)
+ end
+end
diff --git a/spec/serializers/integrations/harbor_serializers/tag_entity_spec.rb b/spec/serializers/integrations/harbor_serializers/tag_entity_spec.rb
new file mode 100644
index 00000000000..f4bc5f71d5b
--- /dev/null
+++ b/spec/serializers/integrations/harbor_serializers/tag_entity_spec.rb
@@ -0,0 +1,38 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Integrations::HarborSerializers::TagEntity do
+ let_it_be(:harbor_integration) { create(:harbor_integration) }
+
+ let(:push_time) { "2022-03-22T09:04:56.186Z" }
+ let(:pull_time) { "2022-03-23T09:04:56.186Z" }
+
+ let(:tag) do
+ {
+ "artifact_id": 5,
+ "id": 6,
+ "immutable": false,
+ "name": "1",
+ "push_time": push_time,
+ "pull_time": pull_time,
+ "repository_id": 5,
+ "signed": false
+ }.deep_stringify_keys
+ end
+
+ subject { described_class.new(tag).as_json }
+
+ it 'returns the Harbor artifact' do
+ expect(subject).to include({
+ harbor_repository_id: 5,
+ harbor_artifact_id: 5,
+ harbor_id: 6,
+ name: "1",
+ pull_time: pull_time.to_datetime.utc,
+ push_time: push_time.to_datetime.utc,
+ signed: false,
+ immutable: false
+ })
+ end
+end
diff --git a/spec/serializers/integrations/harbor_serializers/tag_serializer_spec.rb b/spec/serializers/integrations/harbor_serializers/tag_serializer_spec.rb
new file mode 100644
index 00000000000..45fee0b9b17
--- /dev/null
+++ b/spec/serializers/integrations/harbor_serializers/tag_serializer_spec.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Integrations::HarborSerializers::TagSerializer do
+ it 'represents Integrations::HarborSerializers::TagEntity entities' do
+ expect(described_class.entity_class).to eq(Integrations::HarborSerializers::TagEntity)
+ end
+end
diff --git a/spec/serializers/issue_entity_spec.rb b/spec/serializers/issue_entity_spec.rb
index 9525ed02314..6b9c703c627 100644
--- a/spec/serializers/issue_entity_spec.rb
+++ b/spec/serializers/issue_entity_spec.rb
@@ -139,7 +139,7 @@ RSpec.describe IssueEntity do
end
it 'returns archived project doc' do
- expect(subject[:archived_project_docs_path]).to eq('/help/user/project/settings/index.md#archiving-a-project')
+ expect(subject[:archived_project_docs_path]).to eq('/help/user/project/settings/index.md#archive-a-project')
end
end
end
diff --git a/spec/serializers/member_user_entity_spec.rb b/spec/serializers/member_user_entity_spec.rb
index 85f29845d65..4dd6848c47b 100644
--- a/spec/serializers/member_user_entity_spec.rb
+++ b/spec/serializers/member_user_entity_spec.rb
@@ -51,7 +51,7 @@ RSpec.describe MemberUserEntity do
shared_examples 'correctly exposes user two_factor_enabled' do
context 'when the current_user has a role lower than minimum manage member role' do
before do
- source.add_user(current_user, Gitlab::Access::DEVELOPER)
+ source.add_member(current_user, Gitlab::Access::DEVELOPER)
end
it 'does not expose user two_factor_enabled' do
@@ -65,7 +65,7 @@ RSpec.describe MemberUserEntity do
context 'when the current user has a minimum manage member role or higher' do
before do
- source.add_user(current_user, minimum_manage_member_role)
+ source.add_member(current_user, minimum_manage_member_role)
end
it 'matches json schema' do
diff --git a/spec/serializers/paginated_diff_entity_spec.rb b/spec/serializers/paginated_diff_entity_spec.rb
index db8bf92cbf5..9d4456c11d6 100644
--- a/spec/serializers/paginated_diff_entity_spec.rb
+++ b/spec/serializers/paginated_diff_entity_spec.rb
@@ -43,6 +43,7 @@ RSpec.describe PaginatedDiffEntity do
let(:options) { super().merge(merge_ref_head_diff: merge_ref_head_diff) }
before do
+ allow(merge_request).to receive(:cannot_be_merged?).and_return(true)
allow(MergeRequests::Conflicts::ListService).to receive(:new).and_return(conflicts)
end
diff --git a/spec/serializers/stage_entity_spec.rb b/spec/serializers/stage_entity_spec.rb
index b977d5d33aa..95d3fd254d4 100644
--- a/spec/serializers/stage_entity_spec.rb
+++ b/spec/serializers/stage_entity_spec.rb
@@ -12,12 +12,12 @@ RSpec.describe StageEntity do
end
let(:stage) do
- build(:ci_stage, pipeline: pipeline, name: 'test')
+ create(:ci_stage, pipeline: pipeline, status: :success)
end
before do
allow(request).to receive(:current_user).and_return(user)
- create(:ci_build, :success, pipeline: pipeline)
+ create(:ci_build, :success, pipeline: pipeline, stage_id: stage.id)
end
describe '#as_json' do
@@ -74,7 +74,7 @@ RSpec.describe StageEntity do
end
context 'with a skipped stage ' do
- let(:stage) { create(:ci_stage_entity, status: 'skipped') }
+ let(:stage) { create(:ci_stage, status: 'skipped') }
it 'contains play_all_manual' do
expect(subject[:status][:action]).to be_present
@@ -82,7 +82,7 @@ RSpec.describe StageEntity do
end
context 'with a scheduled stage ' do
- let(:stage) { create(:ci_stage_entity, status: 'scheduled') }
+ let(:stage) { create(:ci_stage, status: 'scheduled') }
it 'contains play_all_manual' do
expect(subject[:status][:action]).to be_present
@@ -90,7 +90,7 @@ RSpec.describe StageEntity do
end
context 'with a manual stage ' do
- let(:stage) { create(:ci_stage_entity, status: 'manual') }
+ let(:stage) { create(:ci_stage, status: 'manual') }
it 'contains play_all_manual' do
expect(subject[:status][:action]).to be_present
diff --git a/spec/serializers/stage_serializer_spec.rb b/spec/serializers/stage_serializer_spec.rb
index 0b5e87dc95b..24e8057375b 100644
--- a/spec/serializers/stage_serializer_spec.rb
+++ b/spec/serializers/stage_serializer_spec.rb
@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe StageSerializer do
let(:project) { create(:project, :repository) }
let(:user) { create(:user) }
- let(:resource) { create(:ci_stage_entity) }
+ let(:resource) { create(:ci_stage) }
let(:serializer) do
described_class.new(current_user: user, project: project)
@@ -21,7 +21,7 @@ RSpec.describe StageSerializer do
end
context 'with an array of entities' do
- let(:resource) { create_list(:ci_stage_entity, 2) }
+ let(:resource) { create_list(:ci_stage, 2) }
it 'serializes the array of pipelines' do
expect(subject).not_to be_empty
diff --git a/spec/serializers/test_reports_comparer_entity_spec.rb b/spec/serializers/test_reports_comparer_entity_spec.rb
index 3f88438ccde..78aa64edae0 100644
--- a/spec/serializers/test_reports_comparer_entity_spec.rb
+++ b/spec/serializers/test_reports_comparer_entity_spec.rb
@@ -7,8 +7,8 @@ RSpec.describe TestReportsComparerEntity do
let(:entity) { described_class.new(comparer) }
let(:comparer) { Gitlab::Ci::Reports::TestReportsComparer.new(base_reports, head_reports) }
- let(:base_reports) { Gitlab::Ci::Reports::TestReports.new }
- let(:head_reports) { Gitlab::Ci::Reports::TestReports.new }
+ let(:base_reports) { Gitlab::Ci::Reports::TestReport.new }
+ let(:head_reports) { Gitlab::Ci::Reports::TestReport.new }
describe '#as_json' do
subject { entity.as_json }
diff --git a/spec/serializers/test_reports_comparer_serializer_spec.rb b/spec/serializers/test_reports_comparer_serializer_spec.rb
index f9c37f49039..d19d9681e07 100644
--- a/spec/serializers/test_reports_comparer_serializer_spec.rb
+++ b/spec/serializers/test_reports_comparer_serializer_spec.rb
@@ -8,8 +8,8 @@ RSpec.describe TestReportsComparerSerializer do
let(:project) { double(:project) }
let(:serializer) { described_class.new(project: project).represent(comparer) }
let(:comparer) { Gitlab::Ci::Reports::TestReportsComparer.new(base_reports, head_reports) }
- let(:base_reports) { Gitlab::Ci::Reports::TestReports.new }
- let(:head_reports) { Gitlab::Ci::Reports::TestReports.new }
+ let(:base_reports) { Gitlab::Ci::Reports::TestReport.new }
+ let(:head_reports) { Gitlab::Ci::Reports::TestReport.new }
describe '#to_json' do
subject { serializer.to_json }