File: rdoc_generator_spec.rb

package info (click to toggle)
ruby-sdoc 2.6.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 968 kB
  • sloc: javascript: 4,455; ruby: 629; makefile: 3
file content (48 lines) | stat: -rw-r--r-- 1,154 bytes parent folder | download
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
39
40
41
42
43
44
45
46
47
48
require File.join(File.dirname(__FILE__), '/spec_helper')

describe RDoc::Generator::SDoc do
  before :each do
    @options = RDoc::Options.new
    @options.setup_generator 'sdoc'
    @parser = @options.option_parser
  end

  it "should find sdoc generator" do
    _(RDoc::RDoc::GENERATORS).must_include 'sdoc'
  end

  it "should use sdoc generator" do
    _(@options.generator).must_equal RDoc::Generator::SDoc
    _(@options.generator_name).must_equal 'sdoc'
  end

  it "should parse github option" do
    assert !@options.github

    _, err = capture_io do
      @parser.parse %w[--github]
    end

    _(err).wont_match(/^invalid options/)
    _(@options.github).must_equal true
  end

  it "should parse github short-hand option" do
    assert !@options.github

    _, err = capture_io do
      @parser.parse %w[-g]
    end

    _(err).wont_match(/^invalid options/)
    _(@options.github).must_equal true
  end

  it "should display SDoc version on -v or --version" do
    out_full  = `./bin/sdoc --version`
    out_short = `./bin/sdoc -v`

    _(out_short.strip).must_equal SDoc::VERSION
    _(out_full.strip).must_equal SDoc::VERSION
  end
end