Feature module provides all methods
@note all features not active will be handled has inactive
Example usage:
repository = SimpleRepository.new
repository.add_active_feature(:feature_name)
Feature.set_repository(repository)
Feature.active?(:feature_name)
# => true
Feature.inactive?(:inactive_feature)
# => false
Feature.with(:feature_name) do
# code will be executed
end
Refreshes list of active features from repository. Useful when using an repository with external source.
Execute the code block with the given features active
Example usage:
Feature.run_with_activated(:feature, :another_feature) do
# your test code here
end
Execute the code block with the given features deactive
Example usage:
Feature.run_with_deactivated(:feature, :another_feature) do
# your test code here
end
Set the feature repository The given repository has to respond to method ‘active_features’ with an array of symbols
@param [Object] repository the repository to get the features from @param [Boolean|Integer] refresh optional (default: false) - auto refresh or refresh after given number of seconds
Return value or execute Proc/lambda depending on Feature status.
@param [Symbol] feature @param [Object] value / lambda to use if feature is active @param [Object] value / lambda to use if feature is inactive
Execute the given code block and store + restore the feature configuration before/after the execution