yard 0.8.7.6 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of yard might be problematic. Click here for more details.

Files changed (225) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +20 -1
  3. data/LICENSE +2 -2
  4. data/README.md +2 -2
  5. data/Rakefile +1 -1
  6. data/bin/yard +0 -0
  7. data/bin/yardoc +0 -0
  8. data/bin/yri +0 -0
  9. data/docs/GettingStarted.md +88 -6
  10. data/docs/images/handlers-class-diagram.png +0 -0
  11. data/docs/images/overview-class-diagram.png +0 -0
  12. data/docs/images/parser-class-diagram.png +0 -0
  13. data/docs/templates/default/fulldoc/html/full_list_tag.erb +6 -4
  14. data/lib/yard/autoload.rb +3 -0
  15. data/lib/yard/cli/yardoc.rb +1 -1
  16. data/lib/yard/code_objects/base.rb +4 -1
  17. data/lib/yard/code_objects/extra_file_object.rb +3 -1
  18. data/lib/yard/code_objects/proxy.rb +2 -2
  19. data/lib/yard/docstring.rb +11 -6
  20. data/lib/yard/handlers/base.rb +1 -2
  21. data/lib/yard/handlers/c/base.rb +19 -0
  22. data/lib/yard/handlers/c/handler_methods.rb +42 -8
  23. data/lib/yard/handlers/c/init_handler.rb +1 -1
  24. data/lib/yard/handlers/c/method_handler.rb +3 -3
  25. data/lib/yard/handlers/ruby/decorator_handler_methods.rb +132 -0
  26. data/lib/yard/handlers/ruby/legacy/private_class_method_handler.rb +1 -1
  27. data/lib/yard/handlers/ruby/private_class_method_handler.rb +6 -39
  28. data/lib/yard/handlers/ruby/private_constant_handler.rb +36 -30
  29. data/lib/yard/handlers/ruby/public_class_method_handler.rb +13 -0
  30. data/lib/yard/handlers/ruby/struct_handler_methods.rb +1 -0
  31. data/lib/yard/handlers/ruby/visibility_handler.rb +5 -8
  32. data/lib/yard/logging.rb +1 -0
  33. data/lib/yard/parser/ruby/ruby_parser.rb +2 -2
  34. data/lib/yard/parser/source_parser.rb +6 -6
  35. data/lib/yard/rake/yardoc_task.rb +2 -2
  36. data/lib/yard/serializers/file_system_serializer.rb +33 -1
  37. data/lib/yard/server/commands/display_file_command.rb +8 -3
  38. data/lib/yard/server/commands/display_object_command.rb +7 -3
  39. data/lib/yard/server/doc_server_helper.rb +2 -8
  40. data/lib/yard/server/doc_server_serializer.rb +2 -4
  41. data/lib/yard/server/router.rb +1 -1
  42. data/lib/yard/server/templates/default/fulldoc/html/css/custom.css +57 -8
  43. data/lib/yard/server/templates/default/layout/html/breadcrumb.erb +2 -10
  44. data/lib/yard/server/templates/default/layout/html/script_setup.erb +1 -2
  45. data/lib/yard/server/templates/default/method_details/html/permalink.erb +3 -3
  46. data/lib/yard/server/templates/doc_server/processing/html/processing.erb +4 -4
  47. data/lib/yard/tags/directives.rb +1 -0
  48. data/lib/yard/tags/library.rb +9 -7
  49. data/lib/yard/tags/overload_tag.rb +4 -1
  50. data/lib/yard/templates/helpers/html_helper.rb +4 -3
  51. data/lib/yard/templates/template_options.rb +3 -0
  52. data/lib/yard/version.rb +1 -1
  53. data/spec/cli/command_parser_spec.rb +14 -14
  54. data/spec/cli/command_spec.rb +11 -11
  55. data/spec/cli/config_spec.rb +32 -32
  56. data/spec/cli/diff_spec.rb +86 -90
  57. data/spec/cli/display_spec.rb +6 -6
  58. data/spec/cli/gems_spec.rb +28 -28
  59. data/spec/cli/graph_spec.rb +8 -8
  60. data/spec/cli/help_spec.rb +8 -8
  61. data/spec/cli/i18n_spec.rb +33 -37
  62. data/spec/cli/list_spec.rb +2 -2
  63. data/spec/cli/markup_types_spec.rb +3 -3
  64. data/spec/cli/server_spec.rb +74 -88
  65. data/spec/cli/stats_spec.rb +14 -14
  66. data/spec/cli/yardoc_spec.rb +316 -321
  67. data/spec/cli/yri_spec.rb +45 -45
  68. data/spec/code_objects/base_spec.rb +174 -173
  69. data/spec/code_objects/class_object_spec.rb +65 -65
  70. data/spec/code_objects/code_object_list_spec.rb +13 -11
  71. data/spec/code_objects/constants_spec.rb +68 -58
  72. data/spec/code_objects/extra_file_object_spec.rb +71 -59
  73. data/spec/code_objects/macro_object_spec.rb +64 -64
  74. data/spec/code_objects/method_object_spec.rb +80 -72
  75. data/spec/code_objects/module_object_spec.rb +47 -47
  76. data/spec/code_objects/namespace_object_spec.rb +51 -51
  77. data/spec/code_objects/proxy_spec.rb +54 -54
  78. data/spec/config_spec.rb +104 -104
  79. data/spec/core_ext/array_spec.rb +5 -5
  80. data/spec/core_ext/file_spec.rb +33 -33
  81. data/spec/core_ext/hash_spec.rb +5 -5
  82. data/spec/core_ext/insertion_spec.rb +18 -18
  83. data/spec/core_ext/module_spec.rb +6 -6
  84. data/spec/core_ext/string_spec.rb +17 -17
  85. data/spec/core_ext/symbol_hash_spec.rb +42 -39
  86. data/spec/docstring_parser_spec.rb +65 -65
  87. data/spec/docstring_spec.rb +137 -130
  88. data/spec/handlers/alias_handler_spec.rb +39 -39
  89. data/spec/handlers/attribute_handler_spec.rb +35 -35
  90. data/spec/handlers/base_spec.rb +60 -51
  91. data/spec/handlers/c/alias_handler_spec.rb +6 -6
  92. data/spec/handlers/c/attribute_handler_spec.rb +12 -12
  93. data/spec/handlers/c/class_handler_spec.rb +35 -22
  94. data/spec/handlers/c/constant_handler_spec.rb +24 -22
  95. data/spec/handlers/c/init_handler_spec.rb +10 -10
  96. data/spec/handlers/c/method_handler_spec.rb +150 -65
  97. data/spec/handlers/c/mixin_handler_spec.rb +5 -5
  98. data/spec/handlers/c/module_handler_spec.rb +27 -15
  99. data/spec/handlers/c/override_comment_handler_spec.rb +14 -14
  100. data/spec/handlers/c/path_handler_spec.rb +8 -8
  101. data/spec/handlers/c/spec_helper.rb +10 -0
  102. data/spec/handlers/c/struct_handler_spec.rb +3 -3
  103. data/spec/handlers/class_condition_handler_spec.rb +18 -18
  104. data/spec/handlers/class_handler_spec.rb +97 -97
  105. data/spec/handlers/class_method_handler_shared_examples.rb +132 -0
  106. data/spec/handlers/class_variable_handler_spec.rb +3 -3
  107. data/spec/handlers/constant_handler_spec.rb +32 -29
  108. data/spec/handlers/decorator_handler_methods_spec.rb +405 -0
  109. data/spec/handlers/dsl_handler_spec.rb +108 -109
  110. data/spec/handlers/examples/constant_handler_001.rb.txt +4 -1
  111. data/spec/handlers/examples/visibility_handler_001.rb.txt +4 -0
  112. data/spec/handlers/exception_handler_spec.rb +23 -23
  113. data/spec/handlers/extend_handler_spec.rb +9 -9
  114. data/spec/handlers/legacy_base_spec.rb +60 -60
  115. data/spec/handlers/method_condition_handler_spec.rb +5 -5
  116. data/spec/handlers/method_handler_spec.rb +92 -92
  117. data/spec/handlers/mixin_handler_spec.rb +25 -25
  118. data/spec/handlers/module_function_handler_spec.rb +24 -24
  119. data/spec/handlers/module_handler_spec.rb +15 -15
  120. data/spec/handlers/private_class_method_handler_spec.rb +4 -48
  121. data/spec/handlers/private_constant_handler_spec.rb +8 -8
  122. data/spec/handlers/processor_spec.rb +12 -12
  123. data/spec/handlers/public_class_method_handler_spec.rb +10 -0
  124. data/spec/handlers/ruby/base_spec.rb +16 -16
  125. data/spec/handlers/ruby/legacy/base_spec.rb +20 -18
  126. data/spec/handlers/spec_helper.rb +1 -1
  127. data/spec/handlers/visibility_handler_spec.rb +25 -21
  128. data/spec/handlers/yield_handler_spec.rb +28 -28
  129. data/spec/i18n/locale_spec.rb +16 -16
  130. data/spec/i18n/message_spec.rb +8 -8
  131. data/spec/i18n/messages_spec.rb +14 -14
  132. data/spec/i18n/pot_generator_spec.rb +32 -32
  133. data/spec/i18n/text_spec.rb +22 -22
  134. data/spec/logging_spec.rb +12 -12
  135. data/spec/options_spec.rb +56 -56
  136. data/spec/parser/base_spec.rb +9 -9
  137. data/spec/parser/c_parser_spec.rb +50 -50
  138. data/spec/parser/ruby/ast_node_spec.rb +7 -7
  139. data/spec/parser/ruby/legacy/statement_list_spec.rb +106 -106
  140. data/spec/parser/ruby/legacy/token_list_spec.rb +27 -27
  141. data/spec/parser/ruby/ruby_parser_spec.rb +123 -113
  142. data/spec/parser/source_parser_spec.rb +224 -224
  143. data/spec/parser/tag_parsing_spec.rb +6 -7
  144. data/spec/rake/yardoc_task_spec.rb +38 -48
  145. data/spec/registry_spec.rb +143 -143
  146. data/spec/registry_store_spec.rb +165 -165
  147. data/spec/rubygems/doc_manager_spec.rb +38 -38
  148. data/spec/serializers/file_system_serializer_spec.rb +53 -33
  149. data/spec/serializers/yardoc_serializer_spec.rb +15 -15
  150. data/spec/server/adapter_spec.rb +15 -15
  151. data/spec/server/commands/base_spec.rb +29 -29
  152. data/spec/server/commands/library_command_spec.rb +12 -12
  153. data/spec/server/commands/static_file_command_spec.rb +28 -28
  154. data/spec/server/doc_server_helper_spec.rb +8 -8
  155. data/spec/server/doc_server_serializer_spec.rb +23 -18
  156. data/spec/server/rack_adapter_spec.rb +6 -6
  157. data/spec/server/router_spec.rb +39 -39
  158. data/spec/server/static_caching_spec.rb +16 -16
  159. data/spec/server/webrick_servlet_spec.rb +6 -7
  160. data/spec/server_spec.rb +3 -3
  161. data/spec/spec_helper.rb +11 -2
  162. data/spec/tags/default_factory_spec.rb +64 -64
  163. data/spec/tags/default_tag_spec.rb +5 -5
  164. data/spec/tags/directives_spec.rb +121 -121
  165. data/spec/tags/library_spec.rb +14 -14
  166. data/spec/tags/overload_tag_spec.rb +24 -24
  167. data/spec/tags/ref_tag_list_spec.rb +12 -12
  168. data/spec/templates/class_spec.rb +3 -3
  169. data/spec/templates/constant_spec.rb +4 -4
  170. data/spec/templates/engine_spec.rb +47 -48
  171. data/spec/templates/examples/class001.html +129 -101
  172. data/spec/templates/examples/class002.html +31 -27
  173. data/spec/templates/examples/method001.html +54 -47
  174. data/spec/templates/examples/method002.html +33 -28
  175. data/spec/templates/examples/method003.html +70 -64
  176. data/spec/templates/examples/method004.html +13 -9
  177. data/spec/templates/examples/method005.html +38 -32
  178. data/spec/templates/examples/module001.html +343 -339
  179. data/spec/templates/examples/module002.html +147 -124
  180. data/spec/templates/examples/module003.html +94 -81
  181. data/spec/templates/examples/module004.html +40 -33
  182. data/spec/templates/helpers/base_helper_spec.rb +91 -95
  183. data/spec/templates/helpers/html_helper_spec.rb +276 -279
  184. data/spec/templates/helpers/html_syntax_highlight_helper_spec.rb +16 -15
  185. data/spec/templates/helpers/markup/rdoc_markup_spec.rb +27 -34
  186. data/spec/templates/helpers/markup_helper_spec.rb +57 -57
  187. data/spec/templates/helpers/method_helper_spec.rb +20 -20
  188. data/spec/templates/helpers/shared_signature_examples.rb +33 -31
  189. data/spec/templates/helpers/text_helper_spec.rb +6 -6
  190. data/spec/templates/method_spec.rb +7 -7
  191. data/spec/templates/module_spec.rb +7 -7
  192. data/spec/templates/onefile_spec.rb +7 -7
  193. data/spec/templates/section_spec.rb +66 -69
  194. data/spec/templates/spec_helper.rb +1 -1
  195. data/spec/templates/tag_spec.rb +5 -5
  196. data/spec/templates/template_spec.rb +158 -158
  197. data/spec/verifier_spec.rb +52 -52
  198. data/templates/default/fulldoc/html/css/full_list.css +32 -31
  199. data/templates/default/fulldoc/html/css/style.css +212 -77
  200. data/templates/default/fulldoc/html/frames.erb +6 -15
  201. data/templates/default/fulldoc/html/full_list.erb +14 -21
  202. data/templates/default/fulldoc/html/full_list_class.erb +1 -1
  203. data/templates/default/fulldoc/html/full_list_file.erb +6 -4
  204. data/templates/default/fulldoc/html/full_list_method.erb +8 -6
  205. data/templates/default/fulldoc/html/js/app.js +100 -76
  206. data/templates/default/fulldoc/html/js/full_list.js +170 -135
  207. data/templates/default/fulldoc/html/setup.rb +50 -7
  208. data/templates/default/layout/html/breadcrumb.erb +0 -2
  209. data/templates/default/layout/html/headers.erb +2 -1
  210. data/templates/default/layout/html/layout.erb +16 -10
  211. data/templates/default/layout/html/script_setup.erb +1 -2
  212. data/templates/default/layout/html/search.erb +7 -2
  213. data/templates/default/layout/html/setup.rb +16 -0
  214. data/templates/default/method/html/header.erb +7 -6
  215. data/templates/default/module/html/attribute_summary.erb +1 -1
  216. data/templates/default/module/html/box_info.erb +24 -18
  217. data/templates/default/module/html/constant_summary.erb +9 -11
  218. data/templates/default/module/html/item_summary.erb +1 -1
  219. data/templates/default/module/html/method_summary.erb +1 -1
  220. data/templates/guide/fulldoc/html/setup.rb +1 -1
  221. data/yard.gemspec +1 -2
  222. metadata +10 -7
  223. data/spec/handlers/examples/private_class_method_handler_001.rb.txt +0 -9
  224. data/spec/handlers/examples/private_class_method_handler_002.rb.txt +0 -18
  225. data/spec/handlers/examples/private_class_method_handler_003.rb.txt +0 -11
@@ -1,15 +1,15 @@
1
1
  require File.dirname(__FILE__) + '/../spec_helper'
2
2
 
3
3
  describe Module do
4
- describe '#class_name' do
5
- it "should return just the name of the class/module" do
6
- YARD::CodeObjects::Base.class_name.should == "Base"
4
+ describe "#class_name" do
5
+ it "returns just the name of the class/module" do
6
+ expect(YARD::CodeObjects::Base.class_name).to eq "Base"
7
7
  end
8
8
  end
9
9
 
10
- describe '#namespace' do
11
- it "should return everything before the class name" do
12
- YARD::CodeObjects::Base.namespace_name.should == "YARD::CodeObjects"
10
+ describe "#namespace" do
11
+ it "returns everything before the class name" do
12
+ expect(YARD::CodeObjects::Base.namespace_name).to eq "YARD::CodeObjects"
13
13
  end
14
14
  end
15
15
  end
@@ -4,39 +4,39 @@ require File.dirname(__FILE__) + '/../spec_helper'
4
4
  #described_in_docs String, '#underscore'
5
5
 
6
6
  describe String do
7
- describe '#shell_split' do
8
- it "should split simple non-quoted text" do
9
- "a b c".shell_split.should == %w(a b c)
7
+ describe "#shell_split" do
8
+ it "splits simple non-quoted text" do
9
+ expect("a b c".shell_split).to eq %w(a b c)
10
10
  end
11
11
 
12
- it "should split double quoted text into single token" do
13
- 'a "b c d" e'.shell_split.should == ["a", "b c d", "e"]
12
+ it "splits double quoted text into single token" do
13
+ expect('a "b c d" e'.shell_split).to eq ["a", "b c d", "e"]
14
14
  end
15
15
 
16
- it "should split single quoted text into single token" do
17
- "a 'b c d' e".shell_split.should == ["a", "b c d", "e"]
16
+ it "splits single quoted text into single token" do
17
+ expect("a 'b c d' e".shell_split).to eq ["a", "b c d", "e"]
18
18
  end
19
19
 
20
- it "should handle escaped quotations in quotes" do
21
- "'a \\' b'".shell_split.should == ["a ' b"]
20
+ it "handles escaped quotations in quotes" do
21
+ expect("'a \\' b'".shell_split).to eq ["a ' b"]
22
22
  end
23
23
 
24
- it "should handle escaped quotations outside quotes" do
25
- "\\'a 'b'".shell_split.should == %w('a b)
24
+ it "handles escaped quotations outside quotes" do
25
+ expect("\\'a 'b'".shell_split).to eq %w('a b)
26
26
  end
27
27
 
28
- it "should handle escaped backslash" do
29
- "\\\\'a b c'".shell_split.should == ['\a b c']
28
+ it "handles escaped backslash" do
29
+ expect("\\\\'a b c'".shell_split).to eq ['\a b c']
30
30
  end
31
31
 
32
- it "should handle any whitespace as space" do
32
+ it "handles any whitespace as space" do
33
33
  text = "foo\tbar\nbaz\r\nfoo2 bar2"
34
- text.shell_split.should == %w(foo bar baz foo2 bar2)
34
+ expect(text.shell_split).to eq %w(foo bar baz foo2 bar2)
35
35
  end
36
36
 
37
- it "should handle complex input" do
37
+ it "handles complex input" do
38
38
  text = "hello \\\"world \"1 2\\\" 3\" a 'b \"\\\\\\'' c"
39
- text.shell_split.should == ["hello", "\"world", "1 2\" 3", "a", "b \"\\'", "c"]
39
+ expect(text.shell_split).to eq ["hello", "\"world", "1 2\" 3", "a", "b \"\\'", "c"]
40
40
  end
41
41
  end
42
42
  end
@@ -1,86 +1,89 @@
1
1
  require File.join(File.dirname(__FILE__), '..', 'spec_helper')
2
2
 
3
3
  describe SymbolHash do
4
-
5
- it "should allow access to keys as String or Symbol" do
4
+ it "allows access to keys as String or Symbol" do
6
5
  h = SymbolHash.new(false)
7
6
  h['test'] = true
8
- h[:test].should == true
9
- h['test'].should == true
7
+ expect(h[:test]).to be true
8
+ expect(h['test']).to be true
10
9
  end
11
10
 
12
- it "should #delete by key as String or Symbol" do
13
- h = SymbolHash.new
14
- h.keys.length.should == 0
11
+ describe "#delete" do
12
+ it "accepts either Strings or Symbols as deletion key" do
13
+ h = SymbolHash.new
14
+ expect(h.keys.length).to eq 0
15
15
 
16
- h['test'] = true
17
- h.keys.length.should == 1
16
+ h['test'] = true
17
+ expect(h.keys.length).to eq 1
18
18
 
19
- h.delete(:test)
20
- h.keys.length.should == 0
19
+ h.delete(:test)
20
+ expect(h.keys.length).to eq 0
21
21
 
22
- h[:test] = true
23
- h.keys.length.should == 1
22
+ h[:test] = true
23
+ expect(h.keys.length).to eq 1
24
24
 
25
- h.delete('test')
26
- h.keys.length.should == 0
25
+ h.delete('test')
26
+ expect(h.keys.length).to eq 0
27
+ end
27
28
  end
28
29
 
29
- it "should return same #has_key? for key as String or Symbol" do
30
- h = SymbolHash.new
31
- h[:test] = 1
32
- h.has_key?(:test).should == true
33
- h.has_key?('test').should == true
30
+ describe "#has_key?" do
31
+ it "returns same result for String or Symbol" do
32
+ h = SymbolHash.new
33
+ h[:test] = 1
34
+ expect(h.has_key?(:test)).to be true
35
+ expect(h.has_key?('test')).to be true
36
+ end
34
37
  end
35
38
 
36
- it "should symbolize value if it is a String (and only a string)" do
39
+ it "symbolizes value if it is a String (and only a string)" do
37
40
  class Substring < String; end
38
41
 
39
42
  h = SymbolHash.new
40
43
  h['test1'] = "hello"
41
44
  h['test2'] = Substring.new("hello")
42
- h['test1'].should == :hello
43
- h['test2'].should == "hello"
45
+ expect(h['test1']).to eq :hello
46
+ expect(h['test2']).to eq "hello"
44
47
  end
45
48
 
46
- it "should not symbolize value if SymbolHash.new(false) is created" do
49
+ it "does not symbolize value if SymbolHash.new(false) is created" do
47
50
  h = SymbolHash.new(false)
48
51
  h['test'] = "hello"
49
- h[:test].should == "hello"
52
+ expect(h[:test]).to eq "hello"
50
53
  end
51
54
 
52
- it "should not symbolize value if it is not a String" do
55
+ it "does not symbolize value if it is not a String" do
53
56
  h = SymbolHash.new
54
57
  h['test'] = [1,2,3]
55
- h['test'].should == [1,2,3]
58
+ expect(h['test']).to eq [1,2,3]
56
59
  end
57
60
 
58
- it "should support symbolization using #update or #merge!" do
61
+ it "supports symbolization using #update or #merge!" do
59
62
  h = SymbolHash.new
60
63
  h.update('test' => 'value')
61
- h[:test].should == :value
64
+ expect(h[:test]).to eq :value
62
65
  h.merge!('test' => 'value2')
63
- h[:test].should == :value2
66
+ expect(h[:test]).to eq :value2
64
67
  end
65
68
 
66
- it "should support symbolization non-destructively using #merge" do
69
+ it "supports symbolization non-destructively using #merge" do
67
70
  h = SymbolHash.new
68
- h.merge('test' => 'value')[:test].should == :value
69
- h.should == SymbolHash.new
71
+ expect(h.merge('test' => 'value')[:test]).to eq :value
72
+ expect(h).to eq SymbolHash.new
70
73
  end
71
74
 
72
- it "should support #initializing of a hash" do
75
+ it "supports #initializing of a hash" do
73
76
  h = SymbolHash[:test => 1]
74
- h[:test].should == 1
75
- h[:somethingelse].should be_nil
77
+ expect(h[:test]).to eq 1
78
+ expect(h[:somethingelse]).to be nil
76
79
  end
77
80
 
78
- it "should support reverse merge syntax" do
81
+ it "supports reverse merge syntax" do
79
82
  opts = {}
80
83
  opts = SymbolHash[
81
84
  'default' => 1
82
85
  ].update(opts)
83
- opts.keys.should == [:default]
84
- opts[:default].should == 1
86
+ expect(opts.keys).to eq [:default]
87
+ expect(opts[:default]).to eq 1
85
88
  end
86
89
  end
@@ -16,8 +16,8 @@ describe YARD::DocstringParser do
16
16
  parse(content, object, handler).to_docstring
17
17
  end
18
18
 
19
- describe '#parse' do
20
- it "should parse comments into tags" do
19
+ describe "#parse" do
20
+ it "parses comments into tags" do
21
21
  doc = docstring(<<-eof)
22
22
  @param name Hello world
23
23
  how are you?
@@ -29,25 +29,25 @@ describe YARD::DocstringParser do
29
29
  right here.
30
30
  eof
31
31
  tags = doc.tags(:param)
32
- tags[0].name.should == "name"
33
- tags[0].text.should == "Hello world\nhow are you?"
34
- tags[1].name.should == "name2"
35
- tags[1].text.should == "this is a new line"
36
- tags[2].name.should == "name3"
37
- tags[2].text.should == "and this\nis a new paragraph:\n\nright here."
32
+ expect(tags[0].name).to eq "name"
33
+ expect(tags[0].text).to eq "Hello world\nhow are you?"
34
+ expect(tags[1].name).to eq "name2"
35
+ expect(tags[1].text).to eq "this is a new line"
36
+ expect(tags[2].name).to eq "name3"
37
+ expect(tags[2].text).to eq "and this\nis a new paragraph:\n\nright here."
38
38
  end
39
39
 
40
- it "should end parsing a tag on de-dent" do
40
+ it "ends parsing a tag on de-dent" do
41
41
  doc = docstring(<<-eof)
42
42
  @note test
43
43
  one two three
44
44
  rest of docstring
45
45
  eof
46
- doc.tag(:note).text.should == "test\none two three"
47
- doc.should == "rest of docstring"
46
+ expect(doc.tag(:note).text).to eq "test\none two three"
47
+ expect(doc).to eq "rest of docstring"
48
48
  end
49
49
 
50
- it "should parse examples embedded in doc" do
50
+ it "parses examples embedded in doc" do
51
51
  doc = docstring(<<-eof)
52
52
  test string here
53
53
  @example code
@@ -59,21 +59,21 @@ test string here
59
59
 
60
60
  more stuff
61
61
  eof
62
- doc.should == "test string here\nmore stuff"
63
- doc.tag(:example).text.should == "\ndef foo(x, y, z)\nend\n\nclass A; end"
62
+ expect(doc).to eq "test string here\nmore stuff"
63
+ expect(doc.tag(:example).text).to eq "\ndef foo(x, y, z)\nend\n\nclass A; end"
64
64
  end
65
65
 
66
- it "should remove only original indentation from beginning of line in tags" do
66
+ it "removes only original indentation from beginning of line in tags" do
67
67
  doc = docstring(<<-eof)
68
68
  @param name
69
69
  some value
70
70
  foo bar
71
71
  baz
72
72
  eof
73
- doc.tag(:param).text.should == "some value\nfoo bar\n baz"
73
+ expect(doc.tag(:param).text).to eq "some value\nfoo bar\n baz"
74
74
  end
75
75
 
76
- it "should allow numbers in tags" do
76
+ it "allows numbers in tags" do
77
77
  Tags::Library.define_tag(nil, :foo1)
78
78
  Tags::Library.define_tag(nil, :foo2)
79
79
  Tags::Library.define_tag(nil, :foo3)
@@ -82,142 +82,142 @@ eof
82
82
  @foo2 bar2
83
83
  @foo3 bar3
84
84
  eof
85
- doc.tag(:foo1).text.should == "bar1"
86
- doc.tag(:foo2).text.should == "bar2"
85
+ expect(doc.tag(:foo1).text).to eq "bar1"
86
+ expect(doc.tag(:foo2).text).to eq "bar2"
87
87
  end
88
88
 
89
- it "should end tag on newline if next line is not indented" do
89
+ it "ends tag on newline if next line is not indented" do
90
90
  doc = docstring(<<-eof)
91
91
  @author bar1
92
92
  @api bar2
93
93
  Hello world
94
94
  eof
95
- doc.tag(:author).text.should == "bar1"
96
- doc.tag(:api).text.should == "bar2"
95
+ expect(doc.tag(:author).text).to eq "bar1"
96
+ expect(doc.tag(:api).text).to eq "bar2"
97
97
  end
98
98
 
99
- it "should warn about unknown tag" do
100
- log.should_receive(:warn).with(/Unknown tag @hello$/)
99
+ it "warns about unknown tag" do
100
+ expect(log).to receive(:warn).with(/Unknown tag @hello$/)
101
101
  docstring("@hello world")
102
102
  end
103
103
 
104
- it "should not add trailing whitespace to freeform tags" do
104
+ it "does not add trailing whitespace to freeform tags" do
105
105
  doc = docstring("@api private \t ")
106
- doc.tag(:api).text.should == "private"
106
+ expect(doc.tag(:api).text).to eq "private"
107
107
  end
108
108
  end
109
109
 
110
- describe '#parse with custom tag library' do
110
+ describe "#parse with custom tag library" do
111
111
  class TestLibrary < Tags::Library; end
112
112
 
113
113
  before { @library = TestLibrary.new }
114
114
 
115
- it "should accept valid tags" do
115
+ it "accepts valid tags" do
116
116
  valid = %w( testing valid is_a is_A __ )
117
117
  valid.each do |tag|
118
118
  TestLibrary.define_tag("Tag", tag)
119
119
  doc = docstring('@' + tag + ' foo bar')
120
- doc.tag(tag).text.should == 'foo bar'
120
+ expect(doc.tag(tag).text).to eq 'foo bar'
121
121
  end
122
122
  end
123
123
 
124
- it "should not parse invalid tag names" do
124
+ it "does not parse invalid tag names" do
125
125
  invalid = %w( @ @return@ @param, @x-y @.x.y.z )
126
126
  invalid.each do |tag|
127
- docstring(tag + ' foo bar').should == tag + ' foo bar'
127
+ expect(docstring(tag + ' foo bar')).to eq tag + ' foo bar'
128
128
  end
129
129
  end
130
130
 
131
- it "should allow namespaced tags in the form @x.y.z" do
131
+ it "allows namespaced tags in the form @x.y.z" do
132
132
  TestLibrary.define_tag("Tag", 'x.y.z')
133
133
  doc = docstring("@x.y.z foo bar")
134
- doc.tag('x.y.z').text.should == 'foo bar'
134
+ expect(doc.tag('x.y.z').text).to eq 'foo bar'
135
135
  end
136
136
 
137
- it "should ignore new directives without @! prefix syntax" do
137
+ it "ignores new directives without @! prefix syntax" do
138
138
  TestLibrary.define_directive('dir1', Tags::ScopeDirective)
139
- log.should_receive(:warn).with(/@dir1/)
139
+ expect(log).to receive(:warn).with(/@dir1/)
140
140
  docstring("@dir1")
141
141
  end
142
142
 
143
143
  %w(attribute endgroup group macro method scope visibility).each do |tag|
144
- it "should handle non prefixed @#{tag} syntax as directive, not tag" do
144
+ it "handles non prefixed @#{tag} syntax as directive, not tag" do
145
145
  TestLibrary.define_directive(tag, Tags::ScopeDirective)
146
146
  parse("@#{tag}")
147
- @parser.directives.first.should be_a(Tags::ScopeDirective)
147
+ expect(@parser.directives.first).to be_a(Tags::ScopeDirective)
148
148
  end
149
149
  end
150
150
 
151
- it "should handle directives with @! prefix syntax" do
151
+ it "handles directives with @! prefix syntax" do
152
152
  TestLibrary.define_directive('dir1', Tags::ScopeDirective)
153
153
  docstring("@!dir1 class")
154
- @parser.state.scope.should == :class
154
+ expect(@parser.state.scope).to eq :class
155
155
  end
156
156
  end
157
157
 
158
- describe '#text' do
159
- it "should only return text data" do
158
+ describe "#text" do
159
+ it "only returns text data" do
160
160
  parse("Foo\n@param foo x y z\nBar")
161
- @parser.text.should == "Foo\nBar"
161
+ expect(@parser.text).to eq "Foo\nBar"
162
162
  end
163
163
  end
164
164
 
165
- describe '#raw_text' do
166
- it "should return the entire original data" do
165
+ describe "#raw_text" do
166
+ it "returns the entire original data" do
167
167
  data = "Foo\n@param foo x y z\nBar"
168
168
  parse(data)
169
- @parser.raw_text.should == data
169
+ expect(@parser.raw_text).to eq data
170
170
  end
171
171
  end
172
172
 
173
- describe '#tags' do
174
- it "should return the parsed tags" do
173
+ describe "#tags" do
174
+ it "returns the parsed tags" do
175
175
  data = "Foo\n@param foo x y z\nBar"
176
176
  parse(data)
177
- @parser.tags.size.should == 1
178
- @parser.tags.first.tag_name.should == 'param'
177
+ expect(@parser.tags.size).to eq 1
178
+ expect(@parser.tags.first.tag_name).to eq 'param'
179
179
  end
180
180
  end
181
181
 
182
- describe '#directives' do
183
- it "should group all processed directives" do
182
+ describe "#directives" do
183
+ it "groups all processed directives" do
184
184
  data = "Foo\n@!scope class\n@!visibility private\nBar"
185
185
  parse(data)
186
186
  dirs = @parser.directives
187
187
  dirs.size == 2
188
- dirs[0].should be_a(Tags::ScopeDirective)
189
- dirs[0].tag.text.should == 'class'
190
- dirs[1].should be_a(Tags::VisibilityDirective)
191
- dirs[1].tag.text.should == 'private'
188
+ expect(dirs[0]).to be_a(Tags::ScopeDirective)
189
+ expect(dirs[0].tag.text).to eq 'class'
190
+ expect(dirs[1]).to be_a(Tags::VisibilityDirective)
191
+ expect(dirs[1].tag.text).to eq 'private'
192
192
  end
193
193
  end
194
194
 
195
- describe '#state' do
196
- it "should handle modified state" do
195
+ describe "#state" do
196
+ it "handles modified state" do
197
197
  parse("@!scope class")
198
- @parser.state.scope.should == :class
198
+ expect(@parser.state.scope).to eq :class
199
199
  end
200
200
  end
201
201
 
202
- describe 'after_parse' do
203
- it "should allow specifying of callbacks" do
202
+ describe "after_parse" do
203
+ it "allows specifying of callbacks" do
204
204
  parser = DocstringParser.new
205
205
  the_yielded_obj = nil
206
206
  DocstringParser.after_parse {|obj| the_yielded_obj = obj }
207
207
  parser.parse("Some text")
208
- the_yielded_obj.should == parser
208
+ expect(the_yielded_obj).to eq parser
209
209
  end
210
210
 
211
- it "should warn about invalid named parameters" do
212
- log.should_receive(:warn).with(/@param tag has unknown parameter name: notaparam/)
211
+ it "warns about invalid named parameters" do
212
+ expect(log).to receive(:warn).with(/@param tag has unknown parameter name: notaparam/)
213
213
  YARD.parse_string <<-eof
214
214
  # @param notaparam foo
215
215
  def foo(a) end
216
216
  eof
217
217
  end
218
218
 
219
- it "should warn about duplicate named parameters" do
220
- log.should_receive(:warn).with(/@param tag has duplicate parameter name: a/)
219
+ it "warns about duplicate named parameters" do
220
+ expect(log).to receive(:warn).with(/@param tag has duplicate parameter name: a/)
221
221
  YARD.parse_string <<-eof
222
222
  # @param a foo
223
223
  # @param a foo