diff options
author | Brett Walker <bwalker@gitlab.com> | 2018-12-13 11:47:50 -0600 |
---|---|---|
committer | Brett Walker <bwalker@gitlab.com> | 2018-12-13 11:47:50 -0600 |
commit | fa7b4eca877576936c7af686531603b89cbd9f45 (patch) | |
tree | 8282b0607c22e9381c44a5dca8d9cd0a98b84c40 /spec | |
parent | b5dbfbbac90d067c51f9d2bb80fa5b368ae21548 (diff) | |
download | gitlab-ce-fa7b4eca877576936c7af686531603b89cbd9f45.tar.gz |
Use proper API::Entities::Milestone
Diffstat (limited to 'spec')
-rw-r--r-- | spec/serializers/issue_board_entity_spec.rb | 31 |
1 files changed, 25 insertions, 6 deletions
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 |