Revise how conflicted metadata is handled when applying shared group metadata
Created by: myronmarston
Previously, when applying shared group metadata to a host, if there were any conflicts, the host group metadata would take precedence, but this created some counterintuitive behavior. For example, in a case like this:
RSpec.shared_examples_for "model stuff", db: true do
it "does something using the DB" do
# ...
end
end
RSpec.describe "Some cross cutting concern", db: false do
it_behaves_like "model stuff"
end
...the example from the shared group would NOT have db: true
metadata
in spite of the fact that it_behaves_like
creates a nested group and
if you manually created a nested group at that spot with :db
, it would
take precedence over the outer db: false
metadata.
With this change, metadata applied from a shared group takes precedence over host group metadata if the conflicted value was inherited from a parent group. If the conflicted value was set directly on the host group, it still takes precedence.
Fixes #2306 (closed).
@rspec/rspec: there's definitely room for interpretation in how this should work and I'm not 100% sure this is the behavior we want but I think it's the most reasonable and the most consistent with our metadata inheritance usually works. Thoughts?