Skip to content
Browse files

Fix tests to work with YARD greater than 0.8. [test]

  • Loading branch information...
1 parent 562a56d commit d69a7b65a189a760442603f4de789cf2a0e8e45f @trans trans committed May 2, 2012
Showing with 18 additions and 10 deletions.
  1. +18 −10 test/unit/test_docstring.rb
View
28 test/unit/test_docstring.rb
@@ -3,12 +3,18 @@
require "yard"
require "yard-tomdoc"
-if YARD::VERSION < '0.8'
-
describe YARD::Docstring do
+ make_docstring = Proc.new do |comment|
+ if YARD::VERSION < '0.8'
+ YARD::Docstring.new(comment)
+ else
+ YARD::DocstringParser.new.parse(comment, self).to_docstring
+ end
+ end
+
before do
- @docstring = YARD::Docstring.new <<-eof
+ comment = <<-eof
# Duplicate some text an arbitrary number of times.
#
# text - The String to be duplicated.
@@ -22,6 +28,8 @@
#
# Raises ArgumentError if something bad happened
eof
+
+ @docstring = make_docstring[comment]
end
it "should fill docstring with description" do
@@ -34,7 +42,7 @@
tags[0].name.assert == 'text'
tags[1].name.assert == 'count'
end
-
+
it "should fill examples tags" do
@docstring.tags(:example).size.assert == 1
@docstring.tag(:example).text.assert == "multiplex('Tom', 4)\n # => 'TomTomTomTom'"
@@ -50,21 +58,21 @@
describe "Internal description" do
- it "should fill private tag" do
- docstring = YARD::Docstring.new("# Internal: It will do a big things in future")
- docstring.tag(:private).text.assert == "It will do a big things in future"
+ it "should fill api private tag" do
+ docstring = make_docstring["# Internal: It will do a big things in future"]
+ docstring.tag(:api).text.assert == "private"
end
end
describe "Deprecated description" do
it "should fill deprecated tag" do
- docstring = YARD::Docstring.new("# Deprecated: Don't use this.")
- docstring.tag(:deprecated).text.assert == "Don't use this."
+ docstring = make_docstring["# Deprecated: Some description."]
+ docstring.tag(:deprecated).text.assert == "Do not use this in new code, and replace it when updating old code."
end
end
-end
end
+

0 comments on commit d69a7b6

Please sign in to comment.
Something went wrong with that request. Please try again.