Sha256: f5e4d479df5beb0eb9919e9279e6a2b6375801d8e2bcde8dbf7c4b08f6a4900f

Contents?: true

Size: 1.67 KB

Versions: 67

Compression:

Stored size: 1.67 KB

Contents

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

describe YARD::Tags::RefTagList do
  before { YARD::Registry.clear }

  it "should accept symbol or string as owner's path and convert it into a proxy" do
    t = Tags::RefTagList.new('author', :String)
    t.owner.should == P(:String)
  end

  it "should accept proxy object as owner" do
    t = Tags::RefTagList.new('author', P(:String))
    t.owner.should == P(:String)
  end

  it "should return tags from a proxy object" do
    o = CodeObjects::ClassObject.new(:root, :String)
    t = Tags::Tag.new(:author, 'foo')
    o.docstring.add_tag(t)

    ref = Tags::RefTagList.new('author', :String)
    ref.tags.should == [t]
    ref.tags.first.text.should == 'foo'
  end

  it "should return named tags from a proxy object" do
    o = CodeObjects::ClassObject.new(:root, :String)
    p1 = Tags::Tag.new(:param, 'bar1', nil, 'foo')
    p2 = Tags::Tag.new(:param, 'bar2', nil, 'foo')
    p3 = Tags::Tag.new(:param, 'bar3', nil, 'bar')
    t1 = Tags::Tag.new(:return, 'blah')
    o.docstring.add_tag(p1, t1, p2, p3)

    ref = Tags::RefTagList.new('param', :String, 'foo')
    ref.tags.should == [p1, p2]
    ref.tags.first.text.should == 'bar1'
  end

  it "all tags should respond to #owner and be a RefTag" do
    o = CodeObjects::ClassObject.new(:root, :String)
    p1 = Tags::Tag.new(:param, 'bar1', nil, 'foo')
    p2 = Tags::Tag.new(:param, 'bar2', nil, 'foo')
    p3 = Tags::Tag.new(:param, 'bar3', nil, 'bar')
    t1 = Tags::Tag.new(:return, 'blah')
    o.docstring.add_tag(p1, t1, p2, p3)

    ref = Tags::RefTagList.new('param', :String)
    ref.tags.each do |t|
      t.should be_kind_of(Tags::RefTag)
      t.owner.should == o
    end
  end
end

Version data entries

67 entries across 51 versions & 7 rubygems

Version Path
yard-0.8.7.6 spec/tags/ref_tag_list_spec.rb
yard-0.8.7.5 spec/tags/ref_tag_list_spec.rb
climine-0.0.7 vendor/bundle/ruby/2.0.0/gems/yard-0.8.7.3/spec/tags/ref_tag_list_spec.rb
climine-0.0.7 vendor/bundle/ruby/2.1.0/gems/yard-0.8.7.3/spec/tags/ref_tag_list_spec.rb
climine-0.0.6 vendor/bundle/ruby/2.0.0/gems/yard-0.8.7.3/spec/tags/ref_tag_list_spec.rb
climine-0.0.5 vendor/bundle/ruby/2.0.0/gems/yard-0.8.7.3/spec/tags/ref_tag_list_spec.rb
yard-0.8.7.4 spec/tags/ref_tag_list_spec.rb
climine-0.0.4 vendor/bundle/ruby/2.0.0/gems/yard-0.8.7.3/spec/tags/ref_tag_list_spec.rb
climine-0.0.3 vendor/bundle/ruby/2.0.0/gems/yard-0.8.7.3/spec/tags/ref_tag_list_spec.rb
mango-0.8.0 vendor/bundler/ruby/2.1.0/gems/yard-0.8.7.3/spec/tags/ref_tag_list_spec.rb
mango-0.7.1 vendor/bundler/ruby/2.0.0/gems/yard-0.8.7.3/spec/tags/ref_tag_list_spec.rb
mango-0.7.0 vendor/bundler/ruby/2.0.0/gems/yard-0.8.7.3/spec/tags/ref_tag_list_spec.rb
climine-0.0.2 vendor/bundle/ruby/2.0.0/gems/yard-0.8.7.3/spec/tags/ref_tag_list_spec.rb
climine-0.0.1 vendor/bundle/ruby/2.0.0/gems/yard-0.8.7.3/spec/tags/ref_tag_list_spec.rb
yard-0.8.7.3 spec/tags/ref_tag_list_spec.rb
yard-0.8.7.2 spec/tags/ref_tag_list_spec.rb
candlepin-api-0.4.0 bundle/ruby/1.8/gems/yard-0.8.7/spec/tags/ref_tag_list_spec.rb
candlepin-api-0.4.0 bundle/ruby/1.9.1/gems/yard-0.8.7/spec/tags/ref_tag_list_spec.rb
candlepin-api-0.4.0 bundle/ruby/gems/yard-0.8.7/spec/tags/ref_tag_list_spec.rb
yard-0.8.7.1 spec/tags/ref_tag_list_spec.rb