Getting the name of a group of RSpec examples from a block before (: all)

Basically the question is similar to this: Getting the full RSpec test name from the before (: each) block

I have code like this and it works:

config.before :each do |test|
    p test.example.metadata[:example_group][:full_description]
end

Now I also need to get the name of the group of examples from before :all. How to do it?

+3
source share
1 answer

Try the following:

config.before :all do |test|
  p test.class.metadata[:example_group][:full_description]
end
+3
source

All Articles