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
use feature flag spec helper for all duration specs
ulfertsec01d40440c9
diff --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 bbfd2ae8168..dfb82fe4c5e 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@@ -293,15 +293,13 @@ describe ::API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter doendend- describe 'duration' do+ describe 'duration', with_flag: { work_packages_duration_field_active: true } do+ let(:milestone?) { false }+before do- # TODO: remove feature flag once the implementation is complete- allow(OpenProject::FeatureDecisions)- .to receive(:work_packages_duration_field_active?)- .and_return(true)allow(schema).to receive(:milestone?)- .and_return(false)+ .and_return(milestone?)endit_behaves_like 'has basic schema properties' do@@ -313,24 +311,14 @@ describe ::API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter doendcontext 'when the work package is a milestone' do- before do- allow(schema)- .to receive(:milestone?)- .and_return(true)- end+ let(:milestone?) { true }it 'has no duration attribute' doexpect(subject).not_to have_json_path('duration')endend- context 'when the feature flag is off' do- before do- allow(OpenProject::FeatureDecisions)- .to receive(:work_packages_duration_field_active?)- .and_return(false)- end-+ context 'when the feature flag is off', with_flag: { work_packages_duration_field_active: false } doit 'has no duration attribute' doexpect(subject).not_to have_json_path('duration')end@@ -348,16 +336,7 @@ describe ::API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter doendend- describe 'ignoreNonWorkingDays' do- let(:feature_active) { true }-- before do- # TODO: remove feature flag once the implementation is complete- allow(OpenProject::FeatureDecisions)- .to receive(:work_packages_duration_field_active?)- .and_return(feature_active)- end-+ describe 'ignoreNonWorkingDays', with_flag: { work_packages_duration_field_active: true } doit_behaves_like 'has basic schema properties' dolet(:path) { 'ignoreNonWorkingDays' }let(:type) { 'Boolean' }@@ -366,9 +345,7 @@ describe ::API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter dolet(:writable) { false }end- context 'when the feature flag is off' do- let(:feature_active) { false }-+ context 'when the feature flag is off', with_flag: { work_packages_duration_field_active: false } doit 'has no ignoreNonWorkingDays attribute' doexpect(subject).not_to have_json_path('ignoreNonWorkingDays')enddiff --git a/spec/models/queries/work_packages/columns/property_column_spec.rb b/spec/models/queries/work_packages/columns/property_column_spec.rbindex 035d0750915..5465336bc79 100644--- a/spec/models/queries/work_packages/columns/property_column_spec.rb+++ b/spec/models/queries/work_packages/columns/property_column_spec.rb@@ -55,22 +55,14 @@ describe Queries::WorkPackages::Columns::PropertyColumn, type: :model doendend- context 'when duration feature flag disabled' do+ context 'when duration feature flag disabled', with_flag: { work_packages_duration_field_active: false } doit 'column does not exist' do- allow(OpenProject::FeatureDecisions)- .to receive(:work_packages_duration_field_active?)- .and_return(false)-expect(described_class.instances.map(&:name)).not_to include :durationendend- context 'when duration feature flag enabled' do+ context 'when duration feature flag enabled', with_flag: { work_packages_duration_field_active: true } doit 'column exists' do- allow(OpenProject::FeatureDecisions)- .to receive(:work_packages_duration_field_active?)- .and_return(true)-expect(described_class.instances.map(&:name)).to include :durationendend