Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

  • Loading branch information...
commit d69a7b65a189a760442603f4de789cf2a0e8e45f 1 parent 562a56d
7rans trans authored

Showing 1 changed file with 18 additions and 10 deletions. Show diff stats Hide diff stats

  1. +18 10 test/unit/test_docstring.rb
28 test/unit/test_docstring.rb
@@ -3,12 +3,18 @@
3 3 require "yard"
4 4 require "yard-tomdoc"
5 5
6   -if YARD::VERSION < '0.8'
7   -
8 6 describe YARD::Docstring do
9 7
  8 + make_docstring = Proc.new do |comment|
  9 + if YARD::VERSION < '0.8'
  10 + YARD::Docstring.new(comment)
  11 + else
  12 + YARD::DocstringParser.new.parse(comment, self).to_docstring
  13 + end
  14 + end
  15 +
10 16 before do
11   - @docstring = YARD::Docstring.new <<-eof
  17 + comment = <<-eof
12 18 # Duplicate some text an arbitrary number of times.
13 19 #
14 20 # text - The String to be duplicated.
@@ -22,6 +28,8 @@
22 28 #
23 29 # Raises ArgumentError if something bad happened
24 30 eof
  31 +
  32 + @docstring = make_docstring[comment]
25 33 end
26 34
27 35 it "should fill docstring with description" do
@@ -34,7 +42,7 @@
34 42 tags[0].name.assert == 'text'
35 43 tags[1].name.assert == 'count'
36 44 end
37   -
  45 +
38 46 it "should fill examples tags" do
39 47 @docstring.tags(:example).size.assert == 1
40 48 @docstring.tag(:example).text.assert == "multiplex('Tom', 4)\n # => 'TomTomTomTom'"
@@ -50,9 +58,9 @@
50 58
51 59 describe "Internal description" do
52 60
53   - it "should fill private tag" do
54   - docstring = YARD::Docstring.new("# Internal: It will do a big things in future")
55   - docstring.tag(:private).text.assert == "It will do a big things in future"
  61 + it "should fill api private tag" do
  62 + docstring = make_docstring["# Internal: It will do a big things in future"]
  63 + docstring.tag(:api).text.assert == "private"
56 64 end
57 65
58 66 end
@@ -60,11 +68,11 @@
60 68 describe "Deprecated description" do
61 69
62 70 it "should fill deprecated tag" do
63   - docstring = YARD::Docstring.new("# Deprecated: Don't use this.")
64   - docstring.tag(:deprecated).text.assert == "Don't use this."
  71 + docstring = make_docstring["# Deprecated: Some description."]
  72 + docstring.tag(:deprecated).text.assert == "Do not use this in new code, and replace it when updating old code."
65 73 end
66 74
67 75 end
68   -end
69 76
70 77 end
  78 +

0 comments on commit d69a7b6

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