Sha256: 8a40a59af4959904e27c872346f4b574d9a0ed8401d7fdb5e96172adb5993aa3

Contents?: true

Size: 1005 Bytes

Versions: 6

Compression:

Stored size: 1005 Bytes

Contents

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

describe YARD::Tags::OverloadTag do
  before do
    @tag = Tags::OverloadTag.new(:overload, nil, <<-'eof')
      def bar(a, b = 1, &block)
        Hello world
        @param a [String]
        @return [String]
    eof
  end
  
  it "should parse the first line as a method signature" do
    @tag.signature.should == "def bar(a, b = 1, &block)"
    @tag.parameters.should == [[:a, nil], [:b, "1"], [:"&block", nil]]
  end
  
  it "should parse the rest of the text as a new Docstring" do
    @tag.docstring.should be_instance_of(Docstring)
    @tag.docstring.should == "Hello world"
  end
  
  it "should set Docstring's object after #object= is called" do
    m = mock(:object)
    @tag.object = m
    @tag.docstring.object.should == m
  end
  
  it "should respond to #tag, #tags and #has_tag?" do
    @tag.object = mock(:object)
    @tag.tags.size.should == 2
    @tag.tag(:param).name.should == "a"
    @tag.has_tag?(:return).should == true
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
yard-0.4.0 spec/tags/overload_tag_spec.rb
yard-0.2.3.5 spec/tags/overload_tag_spec.rb
yard-0.2.3.4 spec/tags/overload_tag_spec.rb
yard-0.2.3.2 spec/tags/overload_tag_spec.rb
yard-0.2.3.3 spec/tags/overload_tag_spec.rb
yard-0.2.3 spec/tags/overload_tag_spec.rb