summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2018-12-14 00:26:05 +0000
committerRobert Speicher <rspeicher@gmail.com>2018-12-14 00:26:05 +0000
commit0087396036b265879771380e60787e2072318fd1 (patch)
tree3fc6c2c7024098cf5252f777140881fce88e39f6
parentde9b380e73992de3c76d965f3843d269a03f97f8 (diff)
parentfa7b4eca877576936c7af686531603b89cbd9f45 (diff)
downloadgitlab-ce-0087396036b265879771380e60787e2072318fd1.tar.gz
Merge branch 'bw-fix-missing-board-milestone' into 'master'
Fix Issue boards don't show milestone in issue details See merge request gitlab-org/gitlab-ce!23813
-rw-r--r--app/serializers/issue_board_entity.rb2
-rw-r--r--spec/serializers/issue_board_entity_spec.rb31
2 files changed, 26 insertions, 7 deletions
diff --git a/app/serializers/issue_board_entity.rb b/app/serializers/issue_board_entity.rb
index 58ab804a3c8..e3dc43240c6 100644
--- a/app/serializers/issue_board_entity.rb
+++ b/app/serializers/issue_board_entity.rb
@@ -17,7 +17,7 @@ class IssueBoardEntity < Grape::Entity
end
expose :milestone, expose_nil: false do |issue|
- API::Entities::Project.represent issue.milestone, only: [:id, :title]
+ API::Entities::Milestone.represent issue.milestone, only: [:id, :title]
end
expose :assignees do |issue|
diff --git a/spec/serializers/issue_board_entity_spec.rb b/spec/serializers/issue_board_entity_spec.rb
index 06d9d3657e6..f6fa2a794f6 100644
--- a/spec/serializers/issue_board_entity_spec.rb
+++ b/spec/serializers/issue_board_entity_spec.rb
@@ -3,21 +3,40 @@
require 'spec_helper'
describe IssueBoardEntity do
- let(:project) { create(:project) }
- let(:resource) { create(:issue, project: project) }
- let(:user) { create(:user) }
-
- let(:request) { double('request', current_user: user) }
+ let(:project) { create(:project) }
+ let(:resource) { create(:issue, project: project) }
+ let(:user) { create(:user) }
+ let(:milestone) { create(:milestone, project: project) }
+ let(:label) { create(:label, project: project, title: 'Test Label') }
+ let(:request) { double('request', current_user: user) }
subject { described_class.new(resource, request: request).as_json }
it 'has basic attributes' do
expect(subject).to include(:id, :iid, :title, :confidential, :due_date, :project_id, :relative_position,
- :project, :labels)
+ :labels, :assignees, project: hash_including(:id, :path))
end
it 'has path and endpoints' do
expect(subject).to include(:reference_path, :real_path, :issue_sidebar_endpoint,
:toggle_subscription_endpoint, :assignable_labels_endpoint)
end
+
+ it 'has milestone attributes' do
+ resource.milestone = milestone
+
+ expect(subject).to include(milestone: hash_including(:id, :title))
+ end
+
+ it 'has assignee attributes' do
+ resource.assignees = [user]
+
+ expect(subject).to include(assignees: array_including(hash_including(:id, :name, :username, :avatar_url)))
+ end
+
+ it 'has label attributes' do
+ resource.labels = [label]
+
+ expect(subject).to include(labels: array_including(hash_including(:id, :title, :color, :description, :text_color, :priority)))
+ end
end