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

[48470] Fix rendering of statuses page

Christophe Bliarda9049c08669d
diff --git a/app/components/statuses/row_component.rb b/app/components/statuses/row_component.rb
index 647132d42d0..e15607308c2 100644
--- a/app/components/statuses/row_component.rb
+++ b/app/components/statuses/row_component.rb
@@ -51,7 +51,7 @@ module Statuses
end
def color
- icon_for_color status.color
+ helpers.icon_for_color status.color
end
def done_ratio
@@ -59,9 +59,9 @@ module Statuses
end
def sort
- reorder_links 'status',
- { action: 'update', id: status },
- method: :patch
+ helpers.reorder_links 'status',
+ { action: 'update', id: status },
+ method: :patch
end
def button_links
diff --git a/spec/features/statuses/statuses_administration_spec.rb b/spec/features/statuses/statuses_administration_spec.rb
index 0ff7deb4db4..1a5652516b2 100644
--- a/spec/features/statuses/statuses_administration_spec.rb
+++ b/spec/features/statuses/statuses_administration_spec.rb
@@ -29,22 +29,45 @@
require 'spec_helper'
RSpec.describe 'Statuses administration' do
- let(:admin) { create(:admin) }
+ current_user { create(:admin) }
- before do
- login_as(admin)
- visit new_status_path
- end
+ describe 'New status page' do
+ before do
+ visit new_status_path
+ end
+
+ describe 'with EE token', with_ee: %i[readonly_work_packages] do
+ it 'allows to set readonly status' do
+ expect(page).to have_field 'status[is_readonly]', disabled: false
+ end
+ end
- describe 'with EE token', with_ee: %i[readonly_work_packages] do
- it 'allows to set readonly status' do
- expect(page).to have_field 'status[is_readonly]', disabled: false
+ describe 'without EE token' do
+ it 'does not allow to set readonly status' do
+ expect(page).to have_field 'status[is_readonly]', disabled: true
+ end
end
end
- describe 'without EE token' do
- it 'does not allow to set readonly status' do
- expect(page).to have_field 'status[is_readonly]', disabled: true
+ describe 'Work Package statuses page' do
+ context 'without any statuses' do
+ it 'displays the "no results" text' do
+ visit statuses_path
+ expect(page).to have_content(I18n.t('no_results_title_text'))
+ end
+ end
+
+ context 'with some statuses' do
+ let!(:new_status) { create(:default_status, name: 'I am new') }
+ let!(:in_progress_status) { create(:status, name: 'Working on it') }
+ let!(:closed_status) { create(:closed_status, name: 'Job finished') }
+
+ it 'list statuses' do
+ visit statuses_path
+ expect(page).to have_content('I am new')
+ expect(page).to have_content('Working on it')
+ expect(page).to have_content('Job finished')
+ end
end
end
end