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
path: root/spec
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-01 18:06:05 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-01 18:06:05 +0300
commit05f4b2fb34dbb051b2ce5ddbc801ec42998c019c (patch)
tree0fd7a153f3ed7d00d40e428c08ab81ae3d863afe /spec
parent9e27f0d920cc3891fa7644c5cc0bc280c519fb20 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r--spec/fixtures/api/schemas/evidences/author.json14
-rw-r--r--spec/fixtures/api/schemas/evidences/issue.json26
-rw-r--r--spec/fixtures/api/schemas/evidences/milestone.json27
-rw-r--r--spec/fixtures/api/schemas/evidences/project.json16
-rw-r--r--spec/fixtures/api/schemas/evidences/release.json25
-rw-r--r--spec/frontend/jobs/store/mutations_spec.js1
-rw-r--r--spec/frontend/jobs/store/utils_spec.js93
-rw-r--r--spec/frontend/sidebar/__snapshots__/confidential_issue_sidebar_spec.js.snap8
-rw-r--r--spec/frontend/sidebar/confidential_issue_sidebar_spec.js98
-rw-r--r--spec/lib/gitlab/usage_data_spec.rb30
-rw-r--r--spec/serializers/evidences/author_entity_spec.rb13
-rw-r--r--spec/serializers/evidences/issue_entity_spec.rb13
-rw-r--r--spec/serializers/evidences/milestone_entity_spec.rb35
-rw-r--r--spec/serializers/evidences/project_entity_spec.rb13
-rw-r--r--spec/serializers/evidences/release_entity_spec.rb36
-rw-r--r--spec/serializers/evidences/release_serializer_spec.rb9
16 files changed, 424 insertions, 33 deletions
diff --git a/spec/fixtures/api/schemas/evidences/author.json b/spec/fixtures/api/schemas/evidences/author.json
new file mode 100644
index 00000000000..1b49446900a
--- /dev/null
+++ b/spec/fixtures/api/schemas/evidences/author.json
@@ -0,0 +1,14 @@
+{
+ "type": "object",
+ "required": [
+ "id",
+ "name",
+ "email"
+ ],
+ "properties": {
+ "id": { "type": "integer" },
+ "name": { "type": "string" },
+ "email": { "type": "string" }
+ },
+ "additionalProperties": false
+}
diff --git a/spec/fixtures/api/schemas/evidences/issue.json b/spec/fixtures/api/schemas/evidences/issue.json
new file mode 100644
index 00000000000..10e90dff455
--- /dev/null
+++ b/spec/fixtures/api/schemas/evidences/issue.json
@@ -0,0 +1,26 @@
+{
+ "type": "object",
+ "required": [
+ "id",
+ "title",
+ "description",
+ "author",
+ "state",
+ "iid",
+ "confidential",
+ "created_at",
+ "due_date"
+ ],
+ "properties": {
+ "id": { "type": "integer" },
+ "title": { "type": "string" },
+ "description": { "type": "string" },
+ "author": { "$ref": "author.json" },
+ "state": { "type": "string" },
+ "iid": { "type": "integer" },
+ "confidential": { "type": "boolean" },
+ "created_at": { "type": "date" },
+ "due_date": { "type": "date" }
+ },
+ "additionalProperties": false
+}
diff --git a/spec/fixtures/api/schemas/evidences/milestone.json b/spec/fixtures/api/schemas/evidences/milestone.json
new file mode 100644
index 00000000000..91f0f48bd4c
--- /dev/null
+++ b/spec/fixtures/api/schemas/evidences/milestone.json
@@ -0,0 +1,27 @@
+{
+ "type": "object",
+ "required": [
+ "id",
+ "title",
+ "description",
+ "state",
+ "iid",
+ "created_at",
+ "due_date",
+ "issues"
+ ],
+ "properties": {
+ "id": { "type": "integer" },
+ "title": { "type": "string" },
+ "description": { "type": "string" },
+ "state": { "type": "string" },
+ "iid": { "type": "integer" },
+ "created_at": { "type": "date" },
+ "due_date": { "type": "date" },
+ "issues": {
+ "type": "array",
+ "items": { "$ref": "issue.json" }
+ }
+ },
+ "additionalProperties": false
+}
diff --git a/spec/fixtures/api/schemas/evidences/project.json b/spec/fixtures/api/schemas/evidences/project.json
new file mode 100644
index 00000000000..542686542f8
--- /dev/null
+++ b/spec/fixtures/api/schemas/evidences/project.json
@@ -0,0 +1,16 @@
+{
+ "type": "object",
+ "required": [
+ "id",
+ "name",
+ "description",
+ "created_at"
+ ],
+ "properties": {
+ "id": { "type": "integer" },
+ "name": { "type": "string" },
+ "description": { "type": "string" },
+ "created_at": { "type": "date" }
+ },
+ "additionalProperties": false
+}
diff --git a/spec/fixtures/api/schemas/evidences/release.json b/spec/fixtures/api/schemas/evidences/release.json
new file mode 100644
index 00000000000..68c872a9dc8
--- /dev/null
+++ b/spec/fixtures/api/schemas/evidences/release.json
@@ -0,0 +1,25 @@
+{
+ "type": "object",
+ "required": [
+ "id",
+ "tag",
+ "name",
+ "description",
+ "created_at",
+ "project",
+ "milestones"
+ ],
+ "properties": {
+ "id": { "type": "integer" },
+ "tag": { "type": "string" },
+ "name": { "type": "string" },
+ "description": { "type": "string" },
+ "created_at": { "type": "date" },
+ "project": { "$ref": "project.json" },
+ "milestones": {
+ "type": "array",
+ "items": { "$ref": "milestone.json" }
+ }
+ },
+ "additionalProperties": false
+}
diff --git a/spec/frontend/jobs/store/mutations_spec.js b/spec/frontend/jobs/store/mutations_spec.js
index 8e5ab4b229a..6576f3d1ff2 100644
--- a/spec/frontend/jobs/store/mutations_spec.js
+++ b/spec/frontend/jobs/store/mutations_spec.js
@@ -73,6 +73,7 @@ describe('Jobs Store Mutations', () => {
html,
size: 511846,
complete: true,
+ lines: [],
});
expect(stateCopy.trace).toEqual(html);
diff --git a/spec/frontend/jobs/store/utils_spec.js b/spec/frontend/jobs/store/utils_spec.js
index 18f9026b487..9890e01460e 100644
--- a/spec/frontend/jobs/store/utils_spec.js
+++ b/spec/frontend/jobs/store/utils_spec.js
@@ -6,6 +6,7 @@ import {
addDurationToHeader,
isCollapsibleSection,
findOffsetAndRemove,
+ getIncrementalLineNumber,
} from '~/jobs/store/utils';
import {
utilsMockData,
@@ -292,11 +293,91 @@ describe('Jobs Store Utils', () => {
});
});
+ describe('getIncrementalLineNumber', () => {
+ describe('when last line is 0', () => {
+ it('returns 1', () => {
+ const log = [
+ {
+ content: [],
+ lineNumber: 0,
+ },
+ ];
+
+ expect(getIncrementalLineNumber(log)).toEqual(1);
+ });
+ });
+
+ describe('with unnested line', () => {
+ it('returns the lineNumber of the last item in the array', () => {
+ const log = [
+ {
+ content: [],
+ lineNumber: 10,
+ },
+ {
+ content: [],
+ lineNumber: 101,
+ },
+ ];
+
+ expect(getIncrementalLineNumber(log)).toEqual(102);
+ });
+ });
+
+ describe('when last line is the header section', () => {
+ it('returns the lineNumber of the last item in the array', () => {
+ const log = [
+ {
+ content: [],
+ lineNumber: 10,
+ },
+ {
+ isHeader: true,
+ line: {
+ lineNumber: 101,
+ content: [],
+ },
+ lines: [],
+ },
+ ];
+
+ expect(getIncrementalLineNumber(log)).toEqual(102);
+ });
+ });
+
+ describe('when last line is a nested line', () => {
+ it('returns the lineNumber of the last item in the nested array', () => {
+ const log = [
+ {
+ content: [],
+ lineNumber: 10,
+ },
+ {
+ isHeader: true,
+ line: {
+ lineNumber: 101,
+ content: [],
+ },
+ lines: [
+ {
+ lineNumber: 102,
+ content: [],
+ },
+ { lineNumber: 103, content: [] },
+ ],
+ },
+ ];
+
+ expect(getIncrementalLineNumber(log)).toEqual(104);
+ });
+ });
+ });
+
describe('updateIncrementalTrace', () => {
describe('without repeated section', () => {
it('concats and parses both arrays', () => {
const oldLog = logLinesParser(originalTrace);
- const result = updateIncrementalTrace(originalTrace, oldLog, regularIncremental);
+ const result = updateIncrementalTrace(regularIncremental, oldLog);
expect(result).toEqual([
{
@@ -324,7 +405,7 @@ describe('Jobs Store Utils', () => {
describe('with regular line repeated offset', () => {
it('updates the last line and formats with the incremental part', () => {
const oldLog = logLinesParser(originalTrace);
- const result = updateIncrementalTrace(originalTrace, oldLog, regularIncrementalRepeated);
+ const result = updateIncrementalTrace(regularIncrementalRepeated, oldLog);
expect(result).toEqual([
{
@@ -343,7 +424,7 @@ describe('Jobs Store Utils', () => {
describe('with header line repeated', () => {
it('updates the header line and formats with the incremental part', () => {
const oldLog = logLinesParser(headerTrace);
- const result = updateIncrementalTrace(headerTrace, oldLog, headerTraceIncremental);
+ const result = updateIncrementalTrace(headerTraceIncremental, oldLog);
expect(result).toEqual([
{
@@ -369,11 +450,7 @@ describe('Jobs Store Utils', () => {
describe('with collapsible line repeated', () => {
it('updates the collapsible line and formats with the incremental part', () => {
const oldLog = logLinesParser(collapsibleTrace);
- const result = updateIncrementalTrace(
- collapsibleTrace,
- oldLog,
- collapsibleTraceIncremental,
- );
+ const result = updateIncrementalTrace(collapsibleTraceIncremental, oldLog);
expect(result).toEqual([
{
diff --git a/spec/frontend/sidebar/__snapshots__/confidential_issue_sidebar_spec.js.snap b/spec/frontend/sidebar/__snapshots__/confidential_issue_sidebar_spec.js.snap
index 32d67120183..fd1cfdb1b04 100644
--- a/spec/frontend/sidebar/__snapshots__/confidential_issue_sidebar_spec.js.snap
+++ b/spec/frontend/sidebar/__snapshots__/confidential_issue_sidebar_spec.js.snap
@@ -49,6 +49,8 @@ exports[`Confidential Issue Sidebar Block renders for isConfidential = false and
</div>
</div>
+
+ <!---->
</div>
`;
@@ -111,6 +113,8 @@ exports[`Confidential Issue Sidebar Block renders for isConfidential = false and
</div>
</div>
+
+ <!---->
</div>
`;
@@ -163,6 +167,8 @@ exports[`Confidential Issue Sidebar Block renders for isConfidential = true and
</div>
</div>
+
+ <!---->
</div>
`;
@@ -225,5 +231,7 @@ exports[`Confidential Issue Sidebar Block renders for isConfidential = true and
</div>
</div>
+
+ <!---->
</div>
`;
diff --git a/spec/frontend/sidebar/confidential_issue_sidebar_spec.js b/spec/frontend/sidebar/confidential_issue_sidebar_spec.js
index 0fd50c0e989..1ec5a94ba68 100644
--- a/spec/frontend/sidebar/confidential_issue_sidebar_spec.js
+++ b/spec/frontend/sidebar/confidential_issue_sidebar_spec.js
@@ -2,15 +2,36 @@ import { shallowMount } from '@vue/test-utils';
import ConfidentialIssueSidebar from '~/sidebar/components/confidential/confidential_issue_sidebar.vue';
import { mockTracking, triggerEvent } from 'helpers/tracking_helper';
import EditForm from '~/sidebar/components/confidential/edit_form.vue';
+import SidebarService from '~/sidebar/services/sidebar_service';
+import createFlash from '~/flash';
+import RecaptchaModal from '~/vue_shared/components/recaptcha_modal';
+
+jest.mock('~/flash');
+jest.mock('~/sidebar/services/sidebar_service');
describe('Confidential Issue Sidebar Block', () => {
let wrapper;
- const createComponent = propsData => {
- const service = {
- update: () => Promise.resolve(true),
- };
+ const findRecaptchaModal = () => wrapper.find(RecaptchaModal);
+
+ const triggerUpdateConfidentialAttribute = () => {
+ wrapper.setData({ edit: true });
+ return (
+ // wait for edit form to become visible
+ wrapper.vm
+ .$nextTick()
+ .then(() => {
+ const editForm = wrapper.find(EditForm);
+ const { updateConfidentialAttribute } = editForm.props();
+ updateConfidentialAttribute();
+ })
+ // wait for reCAPTCHA modal to render
+ .then(() => wrapper.vm.$nextTick())
+ );
+ };
+ const createComponent = propsData => {
+ const service = new SidebarService();
wrapper = shallowMount(ConfidentialIssueSidebar, {
propsData: {
service,
@@ -20,6 +41,15 @@ describe('Confidential Issue Sidebar Block', () => {
});
};
+ beforeEach(() => {
+ jest.clearAllMocks();
+ jest.spyOn(window.location, 'reload').mockImplementation();
+ });
+
+ afterEach(() => {
+ wrapper.destroy();
+ });
+
it.each`
isConfidential | isEditable
${false} | ${false}
@@ -38,10 +68,6 @@ describe('Confidential Issue Sidebar Block', () => {
},
);
- afterEach(() => {
- wrapper.destroy();
- });
-
describe('if editable', () => {
beforeEach(() => {
createComponent({
@@ -81,5 +107,61 @@ describe('Confidential Issue Sidebar Block', () => {
property: 'confidentiality',
});
});
+
+ describe('for successful update', () => {
+ beforeEach(() => {
+ SidebarService.prototype.update.mockResolvedValue({ data: 'irrelevant' });
+ });
+
+ it('reloads the page', () =>
+ triggerUpdateConfidentialAttribute().then(() => {
+ expect(window.location.reload).toHaveBeenCalled();
+ }));
+
+ it('does not show an error message', () =>
+ triggerUpdateConfidentialAttribute().then(() => {
+ expect(createFlash).not.toHaveBeenCalled();
+ }));
+ });
+
+ describe('for update error', () => {
+ beforeEach(() => {
+ SidebarService.prototype.update.mockRejectedValue(new Error('updating failed!'));
+ });
+
+ it('does not reload the page', () =>
+ triggerUpdateConfidentialAttribute().then(() => {
+ expect(window.location.reload).not.toHaveBeenCalled();
+ }));
+
+ it('shows an error message', () =>
+ triggerUpdateConfidentialAttribute().then(() => {
+ expect(createFlash).toHaveBeenCalled();
+ }));
+ });
+
+ describe('for spam error', () => {
+ beforeEach(() => {
+ SidebarService.prototype.update.mockRejectedValue({ name: 'SpamError' });
+ });
+
+ it('does not reload the page', () =>
+ triggerUpdateConfidentialAttribute().then(() => {
+ expect(window.location.reload).not.toHaveBeenCalled();
+ }));
+
+ it('does not show an error message', () =>
+ triggerUpdateConfidentialAttribute().then(() => {
+ expect(createFlash).not.toHaveBeenCalled();
+ }));
+
+ it('shows a reCAPTCHA modal', () => {
+ expect(findRecaptchaModal().exists()).toBe(false);
+
+ return triggerUpdateConfidentialAttribute().then(() => {
+ expect(findRecaptchaModal().exists()).toBe(true);
+ });
+ });
+ });
});
});
diff --git a/spec/lib/gitlab/usage_data_spec.rb b/spec/lib/gitlab/usage_data_spec.rb
index e09390a0047..5ad9fb221ca 100644
--- a/spec/lib/gitlab/usage_data_spec.rb
+++ b/spec/lib/gitlab/usage_data_spec.rb
@@ -38,7 +38,7 @@ describe Gitlab::UsageData do
subject { described_class.data }
- it 'gathers usage data' do
+ it 'gathers usage data', :aggregate_failures do
expect(subject.keys).to include(*%i(
active_user_count
counts
@@ -151,7 +151,8 @@ describe Gitlab::UsageData do
todos
uploads
web_hooks
- user_preferences
+ user_preferences_group_overview_details
+ user_preferences_group_overview_security_dashboard
).push(*smau_keys)
count_data = subject[:counts]
@@ -163,7 +164,7 @@ describe Gitlab::UsageData do
expect(expected_keys - count_data.keys).to be_empty
end
- it 'gathers projects data correctly' do
+ it 'gathers projects data correctly', :aggregate_failures do
count_data = subject[:counts]
expect(count_data[:projects]).to eq(4)
@@ -209,11 +210,8 @@ describe Gitlab::UsageData do
describe 'the results of calling #totals on all objects in the array' do
subject { described_class.usage_data_counters.map(&:totals) }
- it do
- is_expected
- .to all(be_a Hash)
- .and all(have_attributes(keys: all(be_a Symbol), values: all(be_a Integer)))
- end
+ it { is_expected.to all(be_a Hash) }
+ it { is_expected.to all(have_attributes(keys: all(be_a Symbol), values: all(be_a Integer))) }
end
it 'does not have any conflicts' do
@@ -226,7 +224,7 @@ describe Gitlab::UsageData do
describe '#features_usage_data_ce' do
subject { described_class.features_usage_data_ce }
- it 'gathers feature usage data' do
+ it 'gathers feature usage data', :aggregate_failures do
expect(subject[:mattermost_enabled]).to eq(Gitlab.config.mattermost.enabled)
expect(subject[:signup_enabled]).to eq(Gitlab::CurrentSettings.allow_signup?)
expect(subject[:ldap_enabled]).to eq(Gitlab.config.ldap.enabled)
@@ -242,7 +240,7 @@ describe Gitlab::UsageData do
describe '#components_usage_data' do
subject { described_class.components_usage_data }
- it 'gathers components usage data' do
+ it 'gathers components usage data', :aggregate_failures do
expect(subject[:gitlab_pages][:enabled]).to eq(Gitlab.config.pages.enabled)
expect(subject[:gitlab_pages][:version]).to eq(Gitlab::Pages::VERSION)
expect(subject[:git][:version]).to eq(Gitlab::Git.version)
@@ -258,7 +256,7 @@ describe Gitlab::UsageData do
describe '#license_usage_data' do
subject { described_class.license_usage_data }
- it 'gathers license data' do
+ it 'gathers license data', :aggregate_failures do
expect(subject[:uuid]).to eq(Gitlab::CurrentSettings.uuid)
expect(subject[:version]).to eq(Gitlab::VERSION)
expect(subject[:installation_type]).to eq('gitlab-development-kit')
@@ -290,11 +288,11 @@ describe Gitlab::UsageData do
end
describe '#approximate_counts' do
- it 'gets approximate counts for selected models' do
+ it 'gets approximate counts for selected models', :aggregate_failures do
create(:label)
expect(Gitlab::Database::Count).to receive(:approximate_counts)
- .with(described_class::APPROXIMATE_COUNT_MODELS).once.and_call_original
+ .with(described_class::APPROXIMATE_COUNT_MODELS).once.and_call_original
counts = described_class.approximate_counts.values
@@ -302,14 +300,12 @@ describe Gitlab::UsageData do
expect(counts.any? { |count| count < 0 }).to be_falsey
end
- it 'returns default values if counts can not be retrieved' do
+ it 'returns default values if counts can not be retrieved', :aggregate_failures do
described_class::APPROXIMATE_COUNT_MODELS.map do |model|
model.name.underscore.pluralize.to_sym
end
- expect(Gitlab::Database::Count).to receive(:approximate_counts)
- .and_return({})
-
+ expect(Gitlab::Database::Count).to receive(:approximate_counts).and_return({})
expect(described_class.approximate_counts.values.uniq).to eq([-1])
end
end
diff --git a/spec/serializers/evidences/author_entity_spec.rb b/spec/serializers/evidences/author_entity_spec.rb
new file mode 100644
index 00000000000..1d0fa95217c
--- /dev/null
+++ b/spec/serializers/evidences/author_entity_spec.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe Evidences::AuthorEntity do
+ let(:entity) { described_class.new(build(:author)) }
+
+ subject { entity.as_json }
+
+ it 'exposes the expected fields' do
+ expect(subject.keys).to contain_exactly(:id, :name, :email)
+ end
+end
diff --git a/spec/serializers/evidences/issue_entity_spec.rb b/spec/serializers/evidences/issue_entity_spec.rb
new file mode 100644
index 00000000000..a1402808757
--- /dev/null
+++ b/spec/serializers/evidences/issue_entity_spec.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe Evidences::IssueEntity do
+ let(:entity) { described_class.new(build(:issue)) }
+
+ subject { entity.as_json }
+
+ it 'exposes the expected fields' do
+ expect(subject.keys).to contain_exactly(:id, :title, :description, :author, :state, :iid, :confidential, :created_at, :due_date)
+ end
+end
diff --git a/spec/serializers/evidences/milestone_entity_spec.rb b/spec/serializers/evidences/milestone_entity_spec.rb
new file mode 100644
index 00000000000..082e178618e
--- /dev/null
+++ b/spec/serializers/evidences/milestone_entity_spec.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe Evidences::MilestoneEntity do
+ let(:milestone) { build(:milestone) }
+ let(:entity) { described_class.new(milestone) }
+
+ subject { entity.as_json }
+
+ it 'exposes the expected fields' do
+ expect(subject.keys).to contain_exactly(:id, :title, :description, :state, :iid, :created_at, :due_date, :issues)
+ end
+
+ context 'when there issues linked to this milestone' do
+ let(:issue_1) { build(:issue) }
+ let(:issue_2) { build(:issue) }
+ let(:milestone) { build(:milestone, issues: [issue_1, issue_2]) }
+
+ it 'exposes these issues' do
+ expect(subject[:issues]).to contain_exactly(
+ Evidences::IssueEntity.new(issue_1).as_json,
+ Evidences::IssueEntity.new(issue_2).as_json
+ )
+ end
+ end
+
+ context 'when the release has no milestone' do
+ let(:milestone) { build(:milestone, issues: []) }
+
+ it 'exposes an empty array for milestones' do
+ expect(subject[:issues]).to be_empty
+ end
+ end
+end
diff --git a/spec/serializers/evidences/project_entity_spec.rb b/spec/serializers/evidences/project_entity_spec.rb
new file mode 100644
index 00000000000..01c160425a8
--- /dev/null
+++ b/spec/serializers/evidences/project_entity_spec.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe Evidences::ProjectEntity do
+ let(:entity) { described_class.new(build(:project)) }
+
+ subject { entity.as_json }
+
+ it 'exposes the expected fields' do
+ expect(subject.keys).to contain_exactly(:id, :name, :description, :created_at)
+ end
+end
diff --git a/spec/serializers/evidences/release_entity_spec.rb b/spec/serializers/evidences/release_entity_spec.rb
new file mode 100644
index 00000000000..8e2be748169
--- /dev/null
+++ b/spec/serializers/evidences/release_entity_spec.rb
@@ -0,0 +1,36 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe Evidences::ReleaseEntity do
+ let(:release) { build(:release) }
+ let(:entity) { described_class.new(release) }
+
+ subject { entity.as_json }
+
+ it 'exposes the expected fields' do
+ expect(subject.keys).to contain_exactly(:id, :tag_name, :name, :description, :created_at, :project, :milestones)
+ end
+
+ context 'when the release has milestones' do
+ let(:project) { create(:project) }
+ let(:milestone_1) { build(:milestone, project: project) }
+ let(:milestone_2) { build(:milestone, project: project) }
+ let(:release) { build(:release, project: project, milestones: [milestone_1, milestone_2]) }
+
+ it 'exposes these milestones' do
+ expect(subject[:milestones]).to contain_exactly(
+ Evidences::MilestoneEntity.new(milestone_1).as_json,
+ Evidences::MilestoneEntity.new(milestone_2).as_json
+ )
+ end
+ end
+
+ context 'when the release has no milestone' do
+ let(:release) { build(:release, milestones: []) }
+
+ it 'exposes an empty array for milestones' do
+ expect(subject[:milestones]).to be_empty
+ end
+ end
+end
diff --git a/spec/serializers/evidences/release_serializer_spec.rb b/spec/serializers/evidences/release_serializer_spec.rb
new file mode 100644
index 00000000000..a0dbf50137c
--- /dev/null
+++ b/spec/serializers/evidences/release_serializer_spec.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe Evidences::ReleaseSerializer do
+ it 'represents an Evidence::ReleaseEntity entity' do
+ expect(described_class.entity_class).to eq(Evidences::ReleaseEntity)
+ end
+end