开发者

Is there a way to generate the documentation for an RSpec test without actually running the test?

开发者 https://www.devze.com 2023-04-12 08:03 出处:网络
For each test in each spec file in a given directory, I would like to generate the output of rspec spec --format documentation, so it looks something like this:

For each test in each spec file in a given directory, I would like to generate the output of rspec spec --format documentation, so it looks something like this:

something
  does something that passes
  does something that fails
  does something that is pending

I don't want it to actually run the tests. I would like a li开发者_高级运维st so that I can gauge the current test coverage level. These are not unit tests, so RCov would be of no use.


This comes a few years too late :D, but here's what you can do:

rspec --dry-run --format documentation


There used to be until we added one liners:

it { should do_something }

That form is widely used and can only generate documentation if it runs.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号