Skip to content

Commit 8737b6e

Browse files
committed
Skip tests tagged as document: false on doc gen
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 new rake task, only the rspec tests that contribute to the generation of API documentation will be executed: RAILS_ENV=test rake docs:generate:skip_undocumenting Aside: For our team, this reduced the amount of tests being executed during docs generation down from 195 to 37.
1 parent 81e5c56 commit 8737b6e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/tasks/docs.rake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,9 @@ RSpec::Core::RakeTask.new('docs:generate:ordered') do |t|
1111
t.pattern = 'spec/acceptance/**/*_spec.rb'
1212
t.rspec_opts = ["--format RspecApiDocumentation::ApiFormatter", "--order defined"]
1313
end
14+
15+
desc "Generate API request documentation from API specs, and skip tests that don't generate any docs"
16+
RSpec::Core::RakeTask.new('docs:generate:skip_undocumenting') do |t|
17+
t.pattern = 'spec/acceptance/**/*_spec.rb'
18+
t.rspec_opts = ["--format RspecApiDocumentation::ApiFormatter", "--tag ~@document:false"]
19+
end

0 commit comments

Comments
 (0)