Skip to content

Commit

Permalink
Fix verifier supporting namespaced tags with special @{tag} syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
lsegal committed May 2, 2012
1 parent b394617 commit 3d2e73b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/yard/verifier.rb
Expand Up @@ -140,8 +140,8 @@ def __execute; #{expr}; end
#
# @return [String] the parsed expression
def parse_expression(expr)
expr = expr.gsub(/@@([\w\.]+)/, 'object.tags("\1")')
expr = expr.gsub(/@([\w\.]+)/, 'object.tag("\1")')
expr = expr.gsub(/@@(?:(\w+)|\{([\w\.]+)\})/, 'object.tags("\1\2")')
expr = expr.gsub(/@(?:(\w+)|\{([\w\.]+)\})/, 'object.tag("\1\2")')
expr
end
end
Expand Down
18 changes: 16 additions & 2 deletions spec/verifier_spec.rb
Expand Up @@ -19,10 +19,24 @@
Verifier.new('@@return').call(obj)
end

it "should allow namespaced tags" do
it "should allow namespaced tag using @{} syntax" do
obj = mock(:object)
obj.should_receive(:tag).with('yard.return')
Verifier.new('@yard.return').call(obj)
Verifier.new('@{yard.return}').call(obj)
end

it "should allow namespaced tags using @{} syntax" do
obj = mock(:object)
obj.should_receive(:tags).with('yard.return')
Verifier.new('@@{yard.return}').call(obj)
end

it "should call methods on tag object" do
obj = mock(:object)
obj2 = mock(:tag)
obj.should_receive(:tag).with('return').and_return obj2
obj2.should_receive(:foo)
Verifier.new('@return.foo').call(obj)
end

it "should send any missing methods to object" do
Expand Down

0 comments on commit 3d2e73b

Please sign in to comment.