基本上问题与此类似:Getting the full RSpec test name from within a before(:each) block
我有这样的代码并且有效:
config.before :each do |test|
p test.example.metadata[:example_group][:full_description]
end
现在我还需要从before :all
中获取示例组名称。我该怎么做?
答案 0 :(得分:3)
试试这个:
config.before :all do |test|
p test.class.metadata[:example_group][:full_description]
end