Sha256: afafe85f32dd3454c98e23b4a860bfc6c8857d6429bfa31c7d1c3527c5d32bbf

Contents?: true

Size: 1.29 KB

Versions: 28

Compression:

Stored size: 1.29 KB

Contents

require File.dirname(__FILE__) + '/spec_helper'

class StringSerializer < YARD::Serializers::Base
  attr_accessor :files, :string
  def initialize(files, string)
    @files = files
    @string = string
  end
  
  def serialize(object, data)
    files << object
    string << data
  end
end

describe YARD::Templates::Engine.template(:default, :onefile) do
  before { Registry.clear }

  it "should render html" do
    files = []
    string = ''
    YARD.parse_string <<-eof
      class A
        # Foo method
        # @return [String]
        def foo; end
        
        # Bar method
        # @return [Numeric]
        def bar; end
      end
    eof
    readme = CodeObjects::ExtraFileObject.new('README', 
      "# This is a code comment\n\n# Top of file\n\n\nclass C; end")
    Templates::Engine.generate Registry.all(:class), 
      :serializer => StringSerializer.new(files, string),
      :onefile => true, :format => :html, :readme => readme, :files => [readme,
        CodeObjects::ExtraFileObject.new('LICENSE', 'This is a license!')
      ]
    files.should == ['index.html']
    string.should include("This is a code comment")
    string.should include("This is a license!")
    string.should include("Class: A")
    string.should include("Foo method")
    string.should include("Bar method")
  end
end

Version data entries

28 entries across 28 versions & 4 rubygems

Version Path
challah-0.6.2 vendor/bundle/gems/yard-0.7.5/spec/templates/onefile_spec.rb
challah-0.6.1 vendor/bundle/gems/yard-0.7.5/spec/templates/onefile_spec.rb
challah-0.6.0 vendor/bundle/gems/yard-0.7.5/spec/templates/onefile_spec.rb
challah-0.5.4 vendor/bundle/gems/yard-0.7.5/spec/templates/onefile_spec.rb
challah-0.5.3 vendor/bundle/gems/yard-0.7.5/spec/templates/onefile_spec.rb
challah-0.5.2 vendor/bundle/gems/yard-0.7.5/spec/templates/onefile_spec.rb
challah-0.5.1 vendor/bundle/gems/yard-0.7.5/spec/templates/onefile_spec.rb
challah-0.5.0 vendor/bundle/gems/yard-0.7.5/spec/templates/onefile_spec.rb
challah-0.4.1 vendor/bundle/gems/yard-0.7.5/spec/templates/onefile_spec.rb
challah-0.4.0 vendor/bundle/gems/yard-0.7.5/spec/templates/onefile_spec.rb
challah-0.3.5 vendor/bundle/gems/yard-0.7.5/spec/templates/onefile_spec.rb
challah-0.3.4 vendor/bundle/gems/yard-0.7.5/spec/templates/onefile_spec.rb
challah-0.3.3 vendor/bundle/gems/yard-0.7.5/spec/templates/onefile_spec.rb
challah-0.3.2 vendor/bundle/gems/yard-0.7.5/spec/templates/onefile_spec.rb
challah-0.3.1 vendor/bundle/gems/yard-0.7.5/spec/templates/onefile_spec.rb
challah-0.3.0 vendor/bundle/gems/yard-0.7.5/spec/templates/onefile_spec.rb
challah-0.2.1 vendor/bundle/gems/yard-0.7.5/spec/templates/onefile_spec.rb
challah-0.2.0 vendor/bundle/gems/yard-0.7.5/spec/templates/onefile_spec.rb
yard-0.7.5 spec/templates/onefile_spec.rb
nutshell-crm-0.0.6.alpha vendor/bundle/gems/yard-0.7.4/spec/templates/onefile_spec.rb