rspec_api_documentation icon indicating copy to clipboard operation
rspec_api_documentation copied to clipboard

Skip tests tagged as document: false on docs generation

Open stwr667 opened this issue 6 years ago • 6 comments

When running the below command to re-generate API docs: RAILS_ENV=test rake docs:generate it will execute every single rspec test under 'spec/acceptance/**/*_spec.rb'. It even executes the tests that are explicitly marked as: document: false With this update, only the rspec tests that contribute to the generation of API documentation will be executed by default, which is much more efficient.

Aside: For our team, this reduced the amount of tests being executed during docs generation down from 195 to 37.

Further notes Relevant RSpec documentation: https://relishapp.com/rspec/rspec-core/docs/command-line/tag-option#exclude-examples-with-a-%60name:value%60-tag-and-@

stwr667 avatar Oct 28 '19 09:10 stwr667

@stwr667 not sure we want to change this behavior, since I am think the intention was to use the task to both confirm all specs pass and generate docs simultaneously. I think there are a couple paths to go here:

  1. add a flag to trigger skipping undocumented specs,
  2. add another rake task,
  3. let users continue to add their own rake tasks when they want customization and add this as an example to the docs.

jakehow avatar Oct 28 '19 15:10 jakehow

I agree with @jakehow, I don't think we want the default to be skipping tests in acceptance as the goal was "if the tests pass you get docs".

I like any of the three ways mentioned for going forward.

oestrich avatar Oct 28 '19 16:10 oestrich

@jakehow, @oestrich, thanks for your feedback. I've gone with option 2.

stwr667 avatar Oct 29 '19 05:10 stwr667

Hi @jakehow, @oestrich, Is there anything else blocking this from going ahead? We've been using this heavily on our generations, and it's been working well. Regards, Steve

stwr667 avatar Oct 31 '19 00:10 stwr667

@jakehow, @oestrich, can I get some feedback on this one please? It'd be good to prevent it from getting in a stale state.

stwr667 avatar Nov 14 '19 08:11 stwr667

Happy new year @jakehow, @oestrich. I made changes as requested. Is there anything else holding this up from being merged?

stwr667 avatar Jan 23 '20 03:01 stwr667