Merge pull request #20377 from opf/use-set-for-available-features

use Set for available_features
This commit is contained in:
Jens Ulferts
2025-09-22 13:19:07 +02:00
committed by GitHub
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -66,11 +66,11 @@ class EnterpriseToken < ApplicationRecord
end
def available_features
active_tokens.map(&:available_features).flatten.uniq
active_tokens.map(&:available_features).inject(Set.new, :|)
end
def non_trialling_features
active_non_trial_tokens.map(&:available_features).flatten.uniq
active_non_trial_tokens.map(&:available_features).inject(Set.new, :|)
end
def trialling_features
+2 -2
View File
@@ -364,7 +364,7 @@ RSpec.describe EnterpriseToken do
let!(: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])
end
end
@@ -372,7 +372,7 @@ RSpec.describe EnterpriseToken do
let!(: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])
end
end