This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Description
Currently, when you define a shared example group with metadata, the implementation does this:
mod = Module.new
(class << mod; self; end).__send__(:define_method, :included) do |host|
host.class_exec(&block)
end
RSpec.configuration.include mod, *metadata_args
It delegates to configuration.include in order to make the shared group auto-included in example groups that have matching metadata.
There's a discrepancy with the scoping rules of shared example groups, though: if the shared group is defined within a nested group it is only available for manual inclusion (using include_context or similar) within that group or a nested group. With the metadata auto-inclusion, the shared group would still be included in any matching example group, even if it's "out of scope" according to our manual inclusion scoping rules.
We should probably address this but maybe in the 4.0 timeframe?
/cc @JonRowe