Skip to content

Commit

Permalink
Add a smoke test, running yard on the full yard source
Browse files Browse the repository at this point in the history
As this will take a significant fraction of the running time of the
whole test suite (roughly 4x more than the rest), we isolate this
test in its own file.

Therefore, one can run the whole test suite as before with:

  bundler exec rake spec

Or the whole test suite except this smoke test:

  rspec --exclude-pattern spec/cli/yard_on_yard_spec.rb
  • Loading branch information
cboos committed Jun 2, 2018
1 parent 2ab0eea commit b4c0de2
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions spec/cli/yard_on_yard_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# frozen_string_literal: true

$TOPDIR = File.expand_path(File.join(File.dirname(__FILE__), '../..'))

require 'fileutils'

RSpec.describe YARD::CLI::Yardoc do
include FileUtils

context 'building the documentation of YARD itself' do
before(:context) do
rm_rf File.join($TOPDIR, 'doc')
rm_rf File.join($TOPDIR, '.yardoc')

# Note: as this is very time consuming, we do it only once
Dir.chdir($TOPDIR) do
@res = YARD::CLI::Yardoc.new.run('--title', 'YARD-On-YARD')
end
end

it 'succeeds and creates doc/ and .yardoc/' do
expect(@res).to be true
expect(Dir.exist?('doc')).to be true
expect(Dir.exist?('.yardoc')).to be true
end

it 'writes the given title in each documentation file' do
Dir.glob(File.join($TOPDIR, 'doc/**/*.html')) do |htmlfile|
next if %w(
frames file_list class_list method_list tag_list _index
).include?(File.basename(htmlfile, '.html'))
html = File.read(htmlfile)

expect(html.index('— YARD-On-YARD')).to be >= 0
end
end
end
end

0 comments on commit b4c0de2

Please sign in to comment.