如果我有一个如下例子:
describe "A flux capacitor" do
it "should flux a lot" do
# how can I access the string object "A flux capacitor" in here???
...
end
end
如何访问所描述的字符串对象“A flux capacitor”? 我尝试过'describe_type'和'described_class'的一些排列 如:
self.described_type.to_s
但是这些总是什么都没有。我做错了什么?
谢谢, - 比尔
答案 0 :(得分:0)
这可能不是最好的方法,但您可以尝试:
example_group_hierarchy.last.description
应返回“父”示例组的描述,并作为字符串连接。当前示例的描述仅为description
。
如果您想获得一系列描述:
example_group_hierarchy.last.nested_descriptions
我刚刚通过在控制台中玩游戏找到了这个,所以请自担风险。