From 1d4ca2d02a09fc2917874e0c9ed990ff8ed5a242 Mon Sep 17 00:00:00 2001 From: Wieland Lindenthal Date: Thu, 19 Sep 2019 18:03:21 +0200 Subject: [PATCH] Fix BCF specs to provide a default type --- modules/bcf/spec/bcf/bcf_xml/importer_spec.rb | 2 +- .../spec/requests/api/bcf_xml/v1/bcf_xml_api_spec.rb | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/modules/bcf/spec/bcf/bcf_xml/importer_spec.rb b/modules/bcf/spec/bcf/bcf_xml/importer_spec.rb index 4fe0b4eb3b..6a7d453d3e 100644 --- a/modules/bcf/spec/bcf/bcf_xml/importer_spec.rb +++ b/modules/bcf/spec/bcf/bcf_xml/importer_spec.rb @@ -27,7 +27,7 @@ describe ::OpenProject::Bcf::BcfXml::Importer do 'application/octet-stream' ) end - let(:type) { FactoryBot.create :type, name: 'Issue' } + let(:type) { FactoryBot.create :type, name: 'Issue', is_standard: true, is_default: true } let(:project) do FactoryBot.create(:project, identifier: 'bim_project', diff --git a/modules/bcf/spec/requests/api/bcf_xml/v1/bcf_xml_api_spec.rb b/modules/bcf/spec/requests/api/bcf_xml/v1/bcf_xml_api_spec.rb index 7c46809e61..8ef2292913 100644 --- a/modules/bcf/spec/requests/api/bcf_xml/v1/bcf_xml_api_spec.rb +++ b/modules/bcf/spec/requests/api/bcf_xml/v1/bcf_xml_api_spec.rb @@ -32,13 +32,15 @@ require 'rack/test' describe 'BCF XML API v1 bcf_xml resource', type: :request do include Rack::Test::Methods + let!(:status) { FactoryBot.create(:status, name: 'New', is_default: true) } + let!(:type) { FactoryBot.create :type, name: 'Issue', is_standard: true, is_default: true } + let!(:priority) { FactoryBot.create(:issue_priority, name: "Mega high", is_default: true) } + let!(:project) { FactoryBot.create(:project, types: [type]) } + let(:current_user) do FactoryBot.create(:user, member_in_project: project, member_through_role: role, firstname: "BIMjamin") end - let(:status) { FactoryBot.create(:status, name: 'New', is_default: true) } - let(:priority) { FactoryBot.create(:issue_priority, name: "Mega high", is_default: true)} - let(:work_package) { FactoryBot.create(:work_package, status: status, priority: priority) } - let(:project) { work_package.project } + let(:work_package) { FactoryBot.create(:work_package, status: status, priority: priority, project: project) } let(:bcf_issue) { FactoryBot.create(:bcf_issue_with_comment, work_package: work_package) } let(:role) { FactoryBot.create(:role, permissions: permissions) } let(:permissions) { %i(view_work_packages view_linked_issues) } @@ -126,6 +128,8 @@ describe 'BCF XML API v1 bcf_xml resource', type: :request do end before do + work_package + expect(project.work_packages.count).to eql(1) post path, params, 'CONTENT_TYPE' => 'multipart/form-data' end