从before(:all)块中获取RSpec示例组名

从before(:all)块中获取RSpec示例组名,rspec,Rspec,基本上,这个问题与此类似: 我有这样的代码,它可以工作: config.before :each do |test| p test.example.metadata[:example_group][:full_description] end 现在,我还需要从before:all中获取示例组名。我该怎么做?试试这个: config.before :all do |test| p test.class.metadata[:example_group][:full_descriptio

基本上,这个问题与此类似:

我有这样的代码,它可以工作:

config.before :each do |test|
    p test.example.metadata[:example_group][:full_description]
end
现在,我还需要从
before:all
中获取示例组名。我该怎么做?

试试这个:

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