File: yard_on_yard_spec.rb

package info (click to toggle)
yard 0.9.38-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,736 kB
  • sloc: ruby: 31,680; javascript: 7,658; makefile: 21
file content (38 lines) | stat: -rw-r--r-- 1,122 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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 if ENV['CI'] || ENV['YY']