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

Remove Projects::Status Model

Aaron Contreras5d595193a831
diff --git a/app/models/project.rb b/app/models/project.rb
index 7dcedbde5d0..4478c620495 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -83,7 +83,6 @@ class Project < ApplicationRecord
-> { order("#{CustomField.table_name}.position") },
join_table: :custom_fields_projects,
association_foreign_key: 'custom_field_id'
- has_one :status, class_name: 'Projects::Status', dependent: :destroy
has_many :budgets, dependent: :destroy
has_many :notification_settings, dependent: :destroy
has_many :projects_storages, dependent: :destroy, class_name: 'Storages::ProjectStorage'
diff --git a/app/models/projects/status.rb b/app/models/projects/status.rb
deleted file mode 100644
index d0af5fc25a3..00000000000
--- a/app/models/projects/status.rb
+++ /dev/null
@@ -1,46 +0,0 @@
-#-- copyright
-# OpenProject is an open source project management software.
-# Copyright (C) 2012-2023 the OpenProject GmbH
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License version 3.
-#
-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-# Copyright (C) 2006-2013 Jean-Philippe Lang
-# Copyright (C) 2010-2013 the ChiliProject Team
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# See COPYRIGHT and LICENSE files for more details.
-#++
-
-class Projects::Status < ApplicationRecord
- belongs_to :project
-
- self.table_name = 'project_statuses'
-
- validates :project,
- presence: true,
- uniqueness: true
-
- enum code: {
- on_track: 0,
- at_risk: 1,
- off_track: 2,
- not_started: 3,
- finished: 4,
- discontinued: 5
- }
-end
diff --git a/spec/factories/project_status.rb b/spec/factories/project_status.rb
deleted file mode 100644
index a3b880a4f50..00000000000
--- a/spec/factories/project_status.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-#-- copyright
-# OpenProject is an open source project management software.
-# Copyright (C) 2012-2023 the OpenProject GmbH
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License version 3.
-#
-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-# Copyright (C) 2006-2013 Jean-Philippe Lang
-# Copyright (C) 2010-2013 the ChiliProject Team
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# See COPYRIGHT and LICENSE files for more details.
-#++
-
-FactoryBot.define do
- factory :project_status, class: 'Projects::Status' do
- project
- sequence(:explanation) { |n| "Status explanation #{n}" }
- code { Projects::Status.codes[:on_track] }
- end
-end
diff --git a/spec/models/projects/status_spec.rb b/spec/models/projects/status_spec.rb
deleted file mode 100644
index a94cca3b9d0..00000000000
--- a/spec/models/projects/status_spec.rb
+++ /dev/null
@@ -1,90 +0,0 @@
-#-- copyright
-# OpenProject is an open source project management software.
-# Copyright (C) 2012-2023 the OpenProject GmbH
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License version 3.
-#
-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-# Copyright (C) 2006-2013 Jean-Philippe Lang
-# Copyright (C) 2010-2013 the ChiliProject Team
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# See COPYRIGHT and LICENSE files for more details.
-#++
-
-require 'spec_helper'
-
-describe Projects::Status do
- let(:project) { create(:project) }
-
- let(:explanation) { 'some explanation' }
- let(:code) { :on_track }
- let(:instance) { described_class.new explanation:, code:, project: }
-
- describe 'explanation' do
- it 'stores an explanation' do
- instance.save
-
- instance.reload
-
- expect(instance.explanation)
- .to eql explanation
- end
- end
-
- describe 'code' do
- it 'stores a code as an enum' do
- instance.save
-
- instance.reload
-
- expect(instance.on_track?)
- .to be_truthy
- end
- end
-
- describe 'project' do
- it 'stores a project reference' do
- instance.save
-
- instance.reload
-
- expect(instance.project)
- .to eql project
- end
-
- it 'requires one' do
- instance.project = nil
-
- expect(instance)
- .to be_invalid
-
- expect(instance.errors.symbols_for(:project))
- .to eql [:blank]
- end
-
- it 'cannot be one already having a status' do
- described_class.create!(explanation: 'some other explanation', code: :off_track, project:)
-
- expect(instance)
- .to be_invalid
-
- expect(instance.errors.symbols_for(:project))
- .to eql [:taken]
- end
- end
-end