Merge branch 'release/11.0' into dev

pull/8840/head
ulferts 4 years ago
commit 9de46582e2
No known key found for this signature in database
GPG Key ID: A205708DE1284017
  1. 2
      Dockerfile
  2. 1
      lib/api/v3/work_packages/work_package_representer.rb
  3. 2
      spec/lib/api/v3/work_packages/work_package_representer_spec.rb
  4. 29
      spec/requests/api/v3/work_package_resource_spec.rb

@ -13,7 +13,7 @@ ARG GITHUB_OAUTH_TOKEN
ARG DEBIAN_FRONTEND=noninteractive
ENV NODE_VERSION="12.18.3"
ENV BUNDLER_VERSION="2.0.2"
ENV BUNDLER_VERSION="2.1.4"
ENV BUNDLE_PATH__SYSTEM=false
ENV APP_USER=app
ENV APP_PATH=/app

@ -535,6 +535,7 @@ module API
self_path = api_v3_paths.work_package_relations(represented.id)
visible_relations = represented
.visible_relations(current_user)
.direct
.non_hierarchy
.includes(::API::V3::Relations::RelationCollectionRepresenter.to_eager_load)

@ -1073,7 +1073,7 @@ describe ::API::V3::WorkPackages::WorkPackageRepresenter do
before do
allow(work_package)
.to receive_message_chain(:visible_relations, :non_hierarchy, :includes)
.to receive_message_chain(:visible_relations, :direct, :non_hierarchy, :includes)
.and_return([relation])
end

@ -310,6 +310,35 @@ describe 'API v3 Work package resource',
.at_path('derivedDueDate')
end
end
describe 'relations' do
let(:directly_related_wp) do
FactoryBot.create(:work_package, project_id: project.id)
end
let(:transitively_related_wp) do
FactoryBot.create(:work_package, project_id: project.id)
end
let(:work_package) do
FactoryBot.create(:work_package,
project_id: project.id,
description: 'lorem ipsum').tap do |wp|
FactoryBot.create(:relation, relates: 1, from: wp, to: directly_related_wp)
FactoryBot.create(:relation, relates: 1, from: directly_related_wp, to: transitively_related_wp)
end
end
it 'embeds all direct relations' do
expect(subject)
.to be_json_eql(1.to_json)
.at_path('_embedded/relations/total')
expect(subject)
.to be_json_eql(api_v3_paths.work_package(directly_related_wp.id).to_json)
.at_path('_embedded/relations/_embedded/elements/0/_links/to/href')
end
end
end
context 'requesting nonexistent work package' do

Loading…
Cancel
Save