-
-
Notifications
You must be signed in to change notification settings - Fork 392
/
tag_spec.rb
64 lines (57 loc) · 1.73 KB
/
tag_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe YARD::Templates::Engine.template(:default, :tags) do
before { Registry.clear }
describe "all known tags" do
before do
YARD.parse_string <<-'eof'
# Comments
# @abstract override me
# @param [Hash] opts the options
# @option opts :key ('') hello
# @option opts :key2 (X) hello
# @return [String] the result
# @raise [Exception] Exception class
# @deprecated for great justice
# @see A
# @see http://url.com
# @see http://url.com Example
# @author Name
# @since 1.0
# @version 1.0
# @yield a block
# @yieldparam [String] a a value
# @yieldreturn [Hash] a hash
# @example Wash your car
# car.wash
# @example To kill a mockingbird
# a = String.new
# flip(a.reverse)
def m(opts = {}) end
eof
end
it "renders text format correctly" do
text_equals(Registry.at('#m').format(text_options), :tag001)
end
end
describe "param tags on non-methods" do
it "does not display @param tags on non-method objects" do
YARD.parse_string <<-'eof'
# @param [#to_s] name the name
module Foo; end
eof
expect { Registry.at('Foo').format(html_options) }
.not_to raise_error
end
end
describe "option tags on non-methods" do
it "does not display @option tags on non-method objects" do
YARD.parse_string <<-'eof'
# @option opts name [#to_s] ('bar') the name
module Foo; end
eof
expect { Registry.at('Foo').format(html_options) }
.not_to raise_error
end
end
end