Sha256: c3249e594614411b441c1b30258b873ce19a5419f4a6ce1f160a04adc878c428

Contents?: true

Size: 1.33 KB

Versions: 12

Compression:

Stored size: 1.33 KB

Contents

require 'rubygems'
require 'minitest/autorun'
require 'rdoc/rdoc'
require 'tmpdir'
require 'fileutils'

class TestRDocGeneratorRI < MiniTest::Unit::TestCase

  def setup
    @pwd = Dir.pwd
    RDoc::TopLevel.reset

    @tmpdir = File.join Dir.tmpdir, "test_rdoc_generator_ri_#{$$}"
    FileUtils.mkdir_p @tmpdir
    Dir.chdir @tmpdir
    options = RDoc::Options.new

    @g = RDoc::Generator::RI.new options

    @top_level = RDoc::TopLevel.new 'file.rb'
    @klass = @top_level.add_class RDoc::NormalClass, 'Object'
    @meth = RDoc::AnyMethod.new nil, 'method'
    @meth_bang = RDoc::AnyMethod.new nil, 'method!'
    @attr = RDoc::Attr.new nil, 'attr', 'RW', ''

    @klass.add_method @meth
    @klass.add_method @meth_bang
    @klass.add_attribute @attr
  end

  def teardown
    Dir.chdir @pwd
    FileUtils.rm_rf @tmpdir
  end

  def assert_file path
    assert File.file?(path), "#{path} is not a file"
  end

  def test_generate
    top_level = RDoc::TopLevel.new 'file.rb'
    top_level.add_class @klass.class, @klass.name

    @g.generate nil

    assert_file File.join(@tmpdir, 'cache.ri')

    assert_file File.join(@tmpdir, 'Object', 'cdesc-Object.ri')

    assert_file File.join(@tmpdir, 'Object', 'attr-i.ri')
    assert_file File.join(@tmpdir, 'Object', 'method-i.ri')
    assert_file File.join(@tmpdir, 'Object', 'method%21-i.ri')
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rdoc-2.5.11 test/test_rdoc_generator_ri.rb
rdoc-2.5.10 test/test_rdoc_generator_ri.rb
rdoc-2.5.9 test/test_rdoc_generator_ri.rb
rdoc-2.5.8 test/test_rdoc_generator_ri.rb
rdoc-2.5.7 test/test_rdoc_generator_ri.rb
rdoc-2.5.6 test/test_rdoc_generator_ri.rb
rdoc-2.5.5 test/test_rdoc_generator_ri.rb
rdoc-2.5.4 test/test_rdoc_generator_ri.rb
rdoc-2.5.3 test/test_rdoc_generator_ri.rb
rdoc-2.5.2 test/test_rdoc_generator_ri.rb
rdoc-2.5.1 test/test_rdoc_generator_ri.rb
rdoc-2.5 test/test_rdoc_generator_ri.rb