Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我对 Rspec 进行了一些测试,如下所示:
describe "description" do before :each do do_before() end it "something_1" do ... end it "something_2" do ... end end
我知道我可以通过使用获取当前测试的名称(“ something_1 ”)
example.description
有没有办法获得before :each区域内所有描述的数组?
before :each
rspec -f d --color --dry-run filename
在 rspec 3.5.2 中为我工作,列出所有测试而不运行它们
曾经有一种方法可以使用标签 --dry-run 来执行此操作,但该方法已被删除并且不再有效。
您可以使用用于格式 = 文档的 -fd。这将向您显示您已完成的所有规格及其外观的长列表。但是,它仍然会运行测试并显示您在此过程中遇到的任何错误。也就是说,它仍然是列出所有测试的好方法。