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
[#64347] use shared examples for #available_formats
Tobias Dillmann0954f5f0466b
diff --git a/spec/lib/open_project/custom_field_format_spec.rb b/spec/lib/open_project/custom_field_format_spec.rbindex 928d5c12ff3..de9eb9ed06f 100644--- a/spec/lib/open_project/custom_field_format_spec.rb+++ b/spec/lib/open_project/custom_field_format_spec.rb@@ -94,39 +94,28 @@ RSpec.describe OpenProject::CustomFieldFormat doenddescribe ".available_formats" do- context "with a custom_field_hierarchies ee", with_ee: [:custom_field_hierarchies] do- it "returns all custom field formats including hierarchy" do+ shared_examples_for "available custom field formats" do |suffix, expected_formats|+ it "returns all custom field formats #{suffix}", :aggregate_failures doformats = described_class.available_formats- expect(formats)- .to contain_exactly("bool", "date", "float", "int", "link", "list", "string", "text", "user",- "version", "hierarchy", "empty")+ expect(formats).to match_array(expected_formats)end+ end- context "with calculated values feature flag enabled", with_flag: { calculated_value_project_attribute: true } do- it "returns all custom field formats including calculated values" do- formats = described_class.available_formats- expect(formats)- .to contain_exactly("bool", "calculated_value", "date", "float", "int", "link", "list", "string", "text",- "user", "version", "hierarchy", "empty")- end- end+ context "with a custom_field_hierarchies ee", with_ee: [:custom_field_hierarchies] do+ it_behaves_like "available custom field formats",+ "including hierarchy",+ %w[bool date float int link list string text user version hierarchy empty]endcontext "without a custom_field_hierarchies ee" do- it "returns all custom field formats excluding hierarchy" do- formats = described_class.available_formats- expect(formats)- .to contain_exactly("bool", "date", "float", "int", "link", "list", "string", "text", "user",- "version", "empty")- end+ it_behaves_like "available custom field formats",+ "excluding hierarchy",+ %w[bool date float int link list string text user version empty]context "with calculated values feature flag enabled", with_flag: { calculated_value_project_attribute: true } do- it "returns all custom field formats including calculated values" do- formats = described_class.available_formats- expect(formats)- .to contain_exactly("bool", "calculated_value", "date", "float", "int", "link", "list", "string", "text",- "user", "version", "empty")- end+ it_behaves_like "available custom field formats",+ "including calculated values",+ %w[bool calculated_value date float int link list string text user version empty]endendend