Commit 68918387 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'bvl-add-spec-license-helpers' into 'master'

Add a EE::LicenseHelpers to easily enable/disable features

Closes #2657

See merge request !2220
parents a5381af7 2b90727c
......@@ -59,6 +59,7 @@ RSpec.configure do |config|
config.include ApiHelpers, :api
config.include Rails.application.routes.url_helpers, type: :routing
config.include MigrationsHelpers, :migration
config.include EE::LicenseHelpers
config.include Rails.application.routes.url_helpers, type: :routing
config.infer_spec_type_from_file_location!
......
module EE
module LicenseHelpers
# Enable/Disable a feature on the License for a spec.
#
# Example:
#
# stub_licensed_features(geo: true, deploy_board: false)
#
# This enables `geo` and disables `deploy_board` features for a spec.
# Other features are still enabled/disabled as defined in the licence.
def stub_licensed_features(features)
allow(License).to receive(:feature_available?).and_call_original
features.each do |feature, enabled|
allow(License).to receive(:feature_available?).with(feature) { enabled }
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment