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 Set for available_features
Ivan Kuchin15cec3382c1c
diff --git a/app/models/enterprise_token.rb b/app/models/enterprise_token.rbindex 4b371f1f282..7495b849ce4 100644--- a/app/models/enterprise_token.rb+++ b/app/models/enterprise_token.rb@@ -72,11 +72,11 @@ class EnterpriseToken < ApplicationRecordenddef available_features- active_tokens.map(&:available_features).flatten.uniq+ active_tokens.map(&:available_features).inject(Set.new, :|)enddef non_trialling_features- active_non_trial_tokens.map(&:available_features).flatten.uniq+ active_non_trial_tokens.map(&:available_features).inject(Set.new, :|)enddef trialling_featuresdiff --git a/spec/models/enterprise_token_spec.rb b/spec/models/enterprise_token_spec.rbindex 739b9c95d7e..4a8f68f619a 100644--- a/spec/models/enterprise_token_spec.rb+++ b/spec/models/enterprise_token_spec.rb@@ -364,7 +364,7 @@ RSpec.describe EnterpriseToken dolet!(:active_token) { create_enterprise_token("an_active_token", plan: :basic, expires_at: 1.year.from_now) }it "returns the features for the plan of the token" do- expect(described_class.available_features).to eq(OpenProject::Token::FEATURES_PER_PLAN[:basic])+ expect(described_class.available_features).to match_array(OpenProject::Token::FEATURES_PER_PLAN[:basic])endend@@ -372,7 +372,7 @@ RSpec.describe EnterpriseToken dolet!(:trial_token) { create_enterprise_token("a_trial_token", plan: :basic, trial: true, expires_at: 1.year.from_now) }it "returns the features for the plan of the token" do- expect(described_class.available_features).to eq(OpenProject::Token::FEATURES_PER_PLAN[:basic])+ expect(described_class.available_features).to match_array(OpenProject::Token::FEATURES_PER_PLAN[:basic])endend