Sha256: cde33053183df306be76f0299b1333d3ebd97f8881008bf1dc8210e1d1ff419f

Contents?: true

Size: 1.47 KB

Versions: 30

Compression:

Stored size: 1.47 KB

Contents

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

class MyDocServerSerializerRouter
  attr_accessor :request
  def docs_prefix; 'PREFIX' end
  def initialize; @request = mock_request end
end

class MockDocServerHelper
  include YARD::Templates::Helpers::BaseHelper
  include YARD::Templates::Helpers::HtmlHelper
  include YARD::Server::DocServerHelper

  attr_accessor :adapter
  attr_accessor :single_library
  attr_accessor :library

  def initialize
    @single_library = false
    @library = LibraryVersion.new('foo')
    @adapter = mock_adapter(:router => MyDocServerSerializerRouter.new)
    @serializer = YARD::Server::DocServerSerializer.new
    @object = YARD::Registry.root
  end
end

describe YARD::Server::DocServerHelper do
  before do
    @helper = MockDocServerHelper.new
  end

  describe '#url_for' do
    it "should not link to /library/ if single_library = true" do
      @helper.single_library = true
      @helper.url_for(Registry.root).should == "/PREFIX/toplevel"
    end

    it "should return /PREFIX/foo/version if foo has a version" do
      @helper.library = LibraryVersion.new('foo', 'bar')
      @helper.adapter.router.request.version_supplied = true
      @helper.url_for(P('A')).should == '/PREFIX/foo/bar/A'
    end
  end

  describe '#url_for_file' do
    it "should properly link file objects using file/ prefix" do
      file = CodeObjects::ExtraFileObject.new('a/b/FooBar.md', '')
      @helper.url_for_file(file).should == '/PREFIX/foo/file/a/b/FooBar.md'
    end
  end
end

Version data entries

30 entries across 21 versions & 3 rubygems

Version Path
challah-1.0.0.beta vendor/bundle/gems/yard-0.8.3/spec/server/doc_server_helper_spec.rb
challah-0.9.1.beta.3 vendor/bundle/gems/yard-0.8.3/spec/server/doc_server_helper_spec.rb
challah-0.9.1.beta vendor/bundle/gems/yard-0.8.3/spec/server/doc_server_helper_spec.rb
challah-0.9.0 vendor/bundle/gems/yard-0.8.3/spec/server/doc_server_helper_spec.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.3/vendor/bundle/gems/yard-0.8.3/spec/server/doc_server_helper_spec.rb
challah-rolls-0.2.0 vendor/bundle/gems/yard-0.8.2.1/spec/server/doc_server_helper_spec.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.0.pre/vendor/bundle/gems/yard-0.8.2.1/spec/server/doc_server_helper_spec.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.3/vendor/bundle/gems/yard-0.8.2.1/spec/server/doc_server_helper_spec.rb
challah-rolls-0.2.0 vendor/bundle/gems/yard-0.8.3/spec/server/doc_server_helper_spec.rb
challah-0.8.3 vendor/bundle/gems/yard-0.8.3/spec/server/doc_server_helper_spec.rb
challah-0.8.3 vendor/bundle/gems/yard-0.8.2.1/spec/server/doc_server_helper_spec.rb
yard-0.8.3 spec/server/doc_server_helper_spec.rb
challah-0.8.1 vendor/bundle/gems/yard-0.8.2.1/spec/server/doc_server_helper_spec.rb
challah-rolls-0.1.0 vendor/bundle/gems/challah-0.8.0.pre/vendor/bundle/gems/yard-0.8.2.1/spec/server/doc_server_helper_spec.rb
challah-rolls-0.1.0 vendor/bundle/gems/yard-0.8.2.1/spec/server/doc_server_helper_spec.rb
challah-0.8.0.pre vendor/bundle/gems/yard-0.8.2.1/spec/server/doc_server_helper_spec.rb
challah-0.7.1 vendor/bundle/gems/yard-0.8.2.1/spec/server/doc_server_helper_spec.rb
challah-0.7.0 vendor/bundle/gems/yard-0.8.2.1/spec/server/doc_server_helper_spec.rb
challah-0.7.0.pre2 vendor/bundle/gems/yard-0.8.2.1/spec/server/doc_server_helper_spec.rb
challah-0.7.0.pre vendor/bundle/gems/yard-0.8.2.1/spec/server/doc_server_helper_spec.rb