OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/lib/scenario_disabler.rb

26 lines
607 B

class ScenarioDisabler
def self.empty_if_disabled(scenario)
if self.disabled?(scenario)
step_collection = scenario.instance_variable_get(:@steps)
step_collection.instance_variable_set(:@steps, [])
true
else
false
end
end
def self.disable(options)
@disabled_scenarios ||= []
@disabled_scenarios << options
end
def self.disabled?(scenario)
@disabled_scenarios.present? && @disabled_scenarios.any? do |disabled_scenario|
disabled_scenario[:feature] == scenario.feature.name && disabled_scenario[:scenario] == scenario.name
end
end
end