We have a shared context that is included automatically by the presence of particular metadata.
I'm wondering if it's possible for the shared context to append or otherwise mutate the example's description with additional text. (Basically we want presence of the included context to be explicit in the example description itself, as well as to include pieces of the metadata itself.)
RSpec.describe Something, auth: :customer do
it "does thing"
end
shared_context "authenticated" do
let(:current_user) { logs_in_as self.class.metadata[:auth] }
# hoping for a before or around hook that can insert contextual description at this scope of the example
end
config.include_context "authenticated", :auth
Desired result: "Something authenticated as a customer does thing"
Have others done something similar or have alternatives?
Thanks,
Jason Karns