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
Better with_ee helper
Christophe Bliardc5b2f97893d3
diff --git a/spec/support/shared/with_ee.rb b/spec/support/shared/with_ee.rbindex a436f58c3db..c5cafa85c78 100644--- a/spec/support/shared/with_ee.rb+++ b/spec/support/shared/with_ee.rb@@ -50,23 +50,18 @@ RSpec.configure do |config|if allowed.present? || example.metadata[:with_ee_trial]allowed = aggregate_parent_array(example, allowed.to_set)- enterprise_token_double = instance_double(EnterpriseToken)- token_object_double = instance_double(OpenProject::Token)- allow(EnterpriseToken).to receive(:allows_to?).and_call_original- allow(token_object_double).to receive(:has_feature?).and_return(false)- allowed.each do |enterprise_feature|- allow(EnterpriseToken).to receive(:allows_to?).with(enterprise_feature).and_return(true)- allow(token_object_double).to receive(:has_feature?).with(enterprise_feature).and_return(true)- end+ # partial double of OpenProject::Token with available features+ token_object = OpenProject::Token.new+ allow(token_object).to receive_messages(available_features: allowed.to_a,+ trial?: !!example.metadata[:with_ee_trial])- # Also signal available features- allow(EnterpriseToken).to receive(:active_tokens).and_return([enterprise_token_double])- allow(enterprise_token_double)- .to receive_messages(token_object: token_object_double,- available_features: allowed.to_a,- expired?: false,- trial?: !!example.metadata[:with_ee_trial],- restrictions: {})+ # partial double of EnterpriseToken returning the partial double of token object+ enterprise_token = EnterpriseToken.new+ allow(enterprise_token).to receive_messages(token_object:)++ # EnterpriseToken is mocked to return the partial double of enterprise+ # token as active token+ allow(EnterpriseToken).to receive(:active_tokens).and_return([enterprise_token])endendend