Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

fix relation representer spec

ulferts4e5c5649e6c8
diff --git a/spec/lib/api/v3/relations/relation_representer_spec.rb b/spec/lib/api/v3/relations/relation_representer_spec.rb
index c67e99a0783..75ddb7d5472 100644
--- a/spec/lib/api/v3/relations/relation_representer_spec.rb
+++ b/spec/lib/api/v3/relations/relation_representer_spec.rb
@@ -31,8 +31,8 @@ require 'spec_helper'
describe ::API::V3::Relations::RelationRepresenter do
let(:user) { FactoryBot.build_stubbed(:admin) }
- let(:from) { FactoryBot.build_stubbed :work_package }
- let(:to) { FactoryBot.build_stubbed :work_package }
+ let(:from) { FactoryBot.build_stubbed(:stubbed_work_package) }
+ let(:to) { FactoryBot.build_stubbed :stubbed_work_package }
let(:type) { "follows" }
let(:description) { "This first" }
@@ -90,11 +90,11 @@ describe ::API::V3::Relations::RelationRepresenter do
end
it 'deserializes the relation correctly' do
- rep = ::API::V3::Relations::RelationRepresenter.new Relation.new, current_user: user
+ rep = ::API::V3::Relations::RelationRepresenter.new OpenStruct.new, current_user: user
rel = rep.from_json result.except(:id).to_json
- expect(rel.from).to eq from
- expect(rel.to).to eq to
+ expect(rel.from_id).to eq from.id.to_s
+ expect(rel.to_id).to eq to.id.to_s
expect(rel.delay).to eq delay
expect(rel.relation_type).to eq type
expect(rel.description).to eq description