class SimpleCov::Profiles
end
# SimpleCov configuration here, same as in SimpleCov.configure
SimpleCov.profiles.define :foo do
loaded using SimpleCov.start :rails and defined using
Profiles are SimpleCov configuration procs that can be easily
def autoload_profile(name)
def autoload_profile(name) require "simplecov/profiles/#{name}" rescue LoadError begin # simplecov:disable — third-party gem fallback (no such gem in test env) require "simplecov-profile-#{name}" # simplecov:enable rescue LoadError # fall through; #fetch_proc raises the user-facing error end end
def define(name, &blk)
end
# Same as SimpleCov.configure do .. here
SimpleCov.profiles.define 'rails' do
Define a SimpleCov profile:
def define(name, &blk) name = name.to_sym raise SimpleCov::ConfigurationError, "SimpleCov Profile '#{name}' is already defined" unless self[name].nil? self[name] = blk end
def fetch_proc(name)
3. require "simplecov-profile-
2. require "simplecov/profiles/
1. already registered via #define
Lookup order:
cannot be located.
bundled or plugin-gem profiles on first lookup. Raises if the profile
Returns the proc registered for the given profile name, autoloading
def fetch_proc(name) name = name.to_sym autoload_profile(name) unless key?(name) return self[name] if key?(name) raise SimpleCov::ConfigurationError, "Could not find SimpleCov Profile called '#{name}'" end
def load(name)
Applies the profile of given name on SimpleCov.configure
def load(name) SimpleCov.configure(&fetch_proc(name)) end