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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Update schema representer specs to mark % complete as read-only
Aaron Contreras80b10315d068
diff --git a/spec/lib/api/v3/work_packages/schema/specific_work_package_schema_spec.rb b/spec/lib/api/v3/work_packages/schema/specific_work_package_schema_spec.rbindex e6d24160d44..a1d9745370c 100644--- a/spec/lib/api/v3/work_packages/schema/specific_work_package_schema_spec.rb+++ b/spec/lib/api/v3/work_packages/schema/specific_work_package_schema_spec.rb@@ -169,25 +169,9 @@ RSpec.describe API::V3::WorkPackages::Schema::SpecificWorkPackageSchema dodescribe '#writable?' dodescribe '% Complete' do- it 'is not writable when inferred by status' do- allow(Setting).to receive(:work_package_done_ratio).and_return('status')+ it 'is not writable' doexpect(subject).not_to be_writable(:done_ratio)end-- it 'is not writable when disabled' do- allow(Setting).to receive(:work_package_done_ratio).and_return('disabled')- expect(subject).not_to be_writable(:done_ratio)- end-- it 'is writable when the work package is a parent' do- allow(work_package).to receive(:leaf?).and_return(false)- expect(subject).to be_writable(:done_ratio)- end-- it 'is writable when the work package is a leaf' do- allow(work_package).to receive(:leaf?).and_return(true)- expect(subject).to be_writable('done_ratio')- endenddescribe 'work' dodiff --git a/spec/lib/api/v3/work_packages/schema/typed_work_package_schema_spec.rb b/spec/lib/api/v3/work_packages/schema/typed_work_package_schema_spec.rbindex cf8c110fb37..e7bcac679f8 100644--- a/spec/lib/api/v3/work_packages/schema/typed_work_package_schema_spec.rb+++ b/spec/lib/api/v3/work_packages/schema/typed_work_package_schema_spec.rb@@ -58,8 +58,8 @@ RSpec.describe API::V3::WorkPackages::Schema::TypedWorkPackageSchema doenddescribe '#writable?' do- it 'percentage done is writable' do- expect(subject).to be_writable(:done_ratio)+ it 'percentage done is not writable' do+ expect(subject).not_to be_writable(:done_ratio)endit 'work is writable' dodiff --git a/spec/lib/api/v3/work_packages/schema/work_package_schema_representer_spec.rb b/spec/lib/api/v3/work_packages/schema/work_package_schema_representer_spec.rbindex 8b6eae5256c..cc573c5e4cd 100644--- a/spec/lib/api/v3/work_packages/schema/work_package_schema_representer_spec.rb+++ b/spec/lib/api/v3/work_packages/schema/work_package_schema_representer_spec.rb@@ -656,30 +656,12 @@ RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter doenddescribe 'percentageDone' do- before do- allow(schema).to receive(:writable?).with('done_ratio').and_return true- end-it_behaves_like 'has basic schema properties' dolet(:path) { 'percentageDone' }let(:type) { 'Integer' }let(:name) { I18n.t('activerecord.attributes.work_package.done_ratio') }let(:required) { false }- let(:writable) { true }- end-- context 'when not writable' do- before do- allow(schema).to receive(:writable?).with('done_ratio').and_return false- end-- it_behaves_like 'has basic schema properties' do- let(:path) { 'percentageDone' }- let(:type) { 'Integer' }- let(:name) { I18n.t('activerecord.attributes.work_package.done_ratio') }- let(:required) { false }- let(:writable) { false }- end+ let(:writable) { false }endcontext 'as disabled' do