Sha256: 2762a3a0d64fc14fe9160fbbd97bfa3833c319966868fa98291fe89953d6ddfe

Contents?: true

Size: 1.09 KB

Versions: 67

Compression:

Stored size: 1.09 KB

Contents

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

describe YARD::Tags::Library do
  def tag(docstring)
    Docstring.new(docstring).tags.first
  end

  describe '#see_tag' do
    it "should take a URL" do
      tag("@see http://example.com").name.should == "http://example.com"
    end

    it "should take an object path" do
      tag("@see String#reverse").name.should == "String#reverse"
    end

    it "should take a description after the url/object" do
      tag = tag("@see http://example.com An Example Site")
      tag.name.should == "http://example.com"
      tag.text.should == "An Example Site"
    end
  end

  describe '.define_tag' do
    it "should allow defining tags with '.' in the name (x.y.z defines method x_y_z)" do
      Tags::Library.define_tag("foo", 'x.y.z')
      Tags::Library.define_tag("foo2", 'x.y.zz', Tags::OverloadTag)
      Tags::Library.instance.method(:x_y_z_tag).should_not be_nil
      Tags::Library.instance.method(:x_y_zz_tag).should_not be_nil
      tag('@x.y.z foo bar').text.should == 'foo bar'
      tag('@x.y.zz foo(bar)').signature.should == 'foo(bar)'
    end
  end
end

Version data entries

67 entries across 51 versions & 7 rubygems

Version Path
challah-0.9.0 vendor/bundle/gems/yard-0.8.3/spec/tags/library_spec.rb
challah-rolls-0.2.0 vendor/bundle/gems/yard-0.8.2.1/spec/tags/library_spec.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.0.pre/vendor/bundle/gems/yard-0.8.2.1/spec/tags/library_spec.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.3/vendor/bundle/gems/yard-0.8.2.1/spec/tags/library_spec.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.3/vendor/bundle/gems/yard-0.8.3/spec/tags/library_spec.rb
challah-rolls-0.2.0 vendor/bundle/gems/yard-0.8.3/spec/tags/library_spec.rb
challah-0.8.3 vendor/bundle/gems/yard-0.8.2.1/spec/tags/library_spec.rb
challah-0.8.3 vendor/bundle/gems/yard-0.8.3/spec/tags/library_spec.rb
yard-0.8.3 spec/tags/library_spec.rb
challah-0.8.1 vendor/bundle/gems/yard-0.8.2.1/spec/tags/library_spec.rb
challah-rolls-0.1.0 vendor/bundle/gems/challah-0.8.0.pre/vendor/bundle/gems/yard-0.8.2.1/spec/tags/library_spec.rb
challah-rolls-0.1.0 vendor/bundle/gems/yard-0.8.2.1/spec/tags/library_spec.rb
challah-0.8.0.pre vendor/bundle/gems/yard-0.8.2.1/spec/tags/library_spec.rb
challah-0.7.1 vendor/bundle/gems/yard-0.8.2.1/spec/tags/library_spec.rb
challah-0.7.0 vendor/bundle/gems/yard-0.8.2.1/spec/tags/library_spec.rb
challah-0.7.0.pre2 vendor/bundle/gems/yard-0.8.2.1/spec/tags/library_spec.rb
challah-0.7.0.pre vendor/bundle/gems/yard-0.8.2.1/spec/tags/library_spec.rb
challah-0.6.2 vendor/bundle/gems/yard-0.8.2/spec/tags/library_spec.rb
challah-0.6.2 vendor/bundle/gems/yard-0.8.1/spec/tags/library_spec.rb
challah-0.6.2 vendor/bundle/gems/yard-0.8.2.1/spec/tags/library_spec.rb