Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions spec/templates/tag_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,16 @@ module Foo; end
.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
2 changes: 1 addition & 1 deletion templates/default/tags/html/option.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% if object.has_tag?(:option) %>
<% if object.has_tag?(:option) && object.respond_to?(:parameters) %>
<% object.parameters.each do |param, default| %>
<% tags = object.tags(:option).select {|x| x.name.to_s == param.to_s.sub(/^\*+|:$/, '') } %>
<% next if tags.empty? %>
Expand Down