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
@@ -4,189 +4,188 @@ require 'ostruct'
4
4
  describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}DSLHandler" do
5
5
  before(:all) { parse_file :dsl_handler_001, __FILE__ }
6
6
 
7
- it "should create a readable attribute when @!attribute r is found" do
7
+ it "creates a readable attribute when @!attribute r is found" do
8
8
  obj = Registry.at('Foo#attr1')
9
- obj.should_not be_nil
10
- obj.should be_reader
11
- obj.tag(:return).types.should == ['Numeric']
12
- Registry.at('Foo#attr1=').should be_nil
9
+ expect(obj).not_to be nil
10
+ expect(obj).to be_reader
11
+ expect(obj.tag(:return).types).to eq ['Numeric']
12
+ expect(Registry.at('Foo#attr1=')).to be nil
13
13
  end
14
14
 
15
- it "should create a writable attribute when @!attribute w is found" do
15
+ it "creates a writable attribute when @!attribute w is found" do
16
16
  obj = Registry.at('Foo#attr2=')
17
- obj.should_not be_nil
18
- obj.should be_writer
19
- Registry.at('Foo#attr2').should be_nil
17
+ expect(obj).not_to be nil
18
+ expect(obj).to be_writer
19
+ expect(Registry.at('Foo#attr2')).to be nil
20
20
  end
21
21
 
22
- it "should default to readwrite @!attribute" do
22
+ it "defaults to readwrite @!attribute" do
23
23
  obj = Registry.at('Foo#attr3')
24
- obj.should_not be_nil
25
- obj.should be_reader
24
+ expect(obj).not_to be nil
25
+ expect(obj).to be_reader
26
26
  obj = Registry.at('Foo#attr3=')
27
- obj.should_not be_nil
28
- obj.should be_writer
27
+ expect(obj).not_to be nil
28
+ expect(obj).to be_writer
29
29
  end
30
30
 
31
- it "should allow @!attribute to define alternate method name" do
32
- Registry.at('Foo#attr4').should be_nil
33
- Registry.at('Foo#custom').should_not be_nil
31
+ it "allows @!attribute to define alternate method name" do
32
+ expect(Registry.at('Foo#attr4')).to be nil
33
+ expect(Registry.at('Foo#custom')).not_to be nil
34
34
  end
35
35
 
36
- it "should default to creating an instance method for any DSL method with special tags" do
36
+ it "defaults to creating an instance method for any DSL method with special tags" do
37
37
  obj = Registry.at('Foo#implicit0')
38
- obj.should_not be_nil
39
- obj.docstring.should == "IMPLICIT METHOD!"
40
- obj.tag(:return).types.should == ['String']
38
+ expect(obj).not_to be nil
39
+ expect(obj.docstring).to eq "IMPLICIT METHOD!"
40
+ expect(obj.tag(:return).types).to eq ['String']
41
41
  end
42
42
 
43
- it "should recognize implicit docstring when it has scope tag" do
43
+ it "recognizes implicit docstring when it has scope tag" do
44
44
  obj = Registry.at("Foo.implicit1")
45
- obj.should_not be_nil
46
- obj.scope.should == :class
45
+ expect(obj).not_to be nil
46
+ expect(obj.scope).to eq :class
47
47
  end
48
48
 
49
- it "should recognize implicit docstring when it has visibility tag" do
49
+ it "recognizes implicit docstring when it has visibility tag" do
50
50
  obj = Registry.at("Foo#implicit2")
51
- obj.should_not be_nil
52
- obj.visibility.should == :protected
51
+ expect(obj).not_to be nil
52
+ expect(obj.visibility).to eq :protected
53
53
  end
54
54
 
55
- it "should not recognize implicit docstring with any other normal tag" do
55
+ it "does not recognize implicit docstring with any other normal tag" do
56
56
  obj = Registry.at('Foo#implicit_invalid3')
57
- obj.should be_nil
57
+ expect(obj).to be nil
58
58
  end
59
59
 
60
- it "should set the method name when using @!method" do
60
+ it "sets the method name when using @!method" do
61
61
  obj = Registry.at('Foo.xyz')
62
- obj.should_not be_nil
63
- obj.signature.should == 'def xyz(a, b, c)'
64
- obj.parameters.should == [['a', nil], ['b', nil], ['c', nil]]
65
- obj.source.should == 'foo_bar'
66
- obj.docstring.should == 'The foo method'
62
+ expect(obj).not_to be nil
63
+ expect(obj.signature).to eq 'def xyz(a, b, c)'
64
+ expect(obj.parameters).to eq [['a', nil], ['b', nil], ['c', nil]]
65
+ expect(obj.source).to eq 'foo_bar'
66
+ expect(obj.docstring).to eq 'The foo method'
67
67
  end
68
68
 
69
- it "should allow setting of @!scope" do
70
- Registry.at('Foo.xyz').scope.should == :class
69
+ it "allows setting of @!scope" do
70
+ expect(Registry.at('Foo.xyz').scope).to eq :class
71
71
  end
72
72
 
73
- it "should create module function if @!scope is module" do
73
+ it "creates module function if @!scope is module" do
74
74
  mod_c = Registry.at('Foo.modfunc1')
75
75
  mod_i = Registry.at('Foo#modfunc1')
76
- mod_c.scope.should == :class
77
- mod_i.visibility.should == :private
76
+ expect(mod_c.scope).to eq :class
77
+ expect(mod_i.visibility).to eq :private
78
78
  end
79
79
 
80
- it "should allow setting of @!visibility" do
81
- Registry.at('Foo.xyz').visibility.should == :protected
80
+ it "allows setting of @!visibility" do
81
+ expect(Registry.at('Foo.xyz').visibility).to eq :protected
82
82
  end
83
83
 
84
- it "should ignore DSL methods without tags" do
85
- Registry.at('Foo#implicit_invalid').should be_nil
84
+ it "ignores DSL methods without tags" do
85
+ expect(Registry.at('Foo#implicit_invalid')).to be nil
86
86
  end
87
87
 
88
- it "should accept a DSL method without tags if it has hash_flag (##)" do
89
- Registry.at('Foo#implicit_valid').should_not be_nil
90
- Registry.at('Foo#implicit_invalid2').should be_nil
88
+ it "accepts a DSL method without tags if it has hash_flag (##)" do
89
+ expect(Registry.at('Foo#implicit_valid')).not_to be nil
90
+ expect(Registry.at('Foo#implicit_invalid2')).to be nil
91
91
  end
92
92
 
93
- it "should allow creation of macros" do
93
+ it "allows creation of macros" do
94
94
  macro = CodeObjects::MacroObject.find('property')
95
- macro.should_not be_nil
96
- macro.should_not be_attached
97
- macro.method_object.should be_nil
95
+ expect(macro).not_to be nil
96
+ expect(macro).not_to be_attached
97
+ expect(macro.method_object).to be nil
98
98
  end
99
99
 
100
- it "should handle macros with no parameters to expand" do
101
- Registry.at('Foo#none').should_not be_nil
102
- Registry.at('Baz#none').signature.should == 'def none(foo, bar)'
100
+ it "handles macros with no parameters to expand" do
101
+ expect(Registry.at('Foo#none')).not_to be nil
102
+ expect(Registry.at('Baz#none').signature).to eq 'def none(foo, bar)'
103
103
  end
104
104
 
105
- it "should expand $N on method definitions" do
106
- Registry.at('Foo#regular_meth').docstring.should == 'a b c'
105
+ it "expands $N on method definitions" do
106
+ expect(Registry.at('Foo#regular_meth').docstring).to eq 'a b c'
107
107
  end
108
108
 
109
- it "should apply new macro docstrings on new objects" do
109
+ it "applies new macro docstrings on new objects" do
110
110
  obj = Registry.at('Foo#name')
111
- obj.should_not be_nil
112
- obj.source.should == 'property :name, String, :a, :b, :c'
113
- obj.signature.should == 'def name(a, b, c)'
114
- obj.docstring.should == 'A property that is awesome.'
115
- obj.tag(:param).name.should == 'a'
116
- obj.tag(:param).text.should == 'first parameter'
117
- obj.tag(:return).types.should == ['String']
118
- obj.tag(:return).text.should == 'the property name'
111
+ expect(obj).not_to be nil
112
+ expect(obj.source).to eq 'property :name, String, :a, :b, :c'
113
+ expect(obj.signature).to eq 'def name(a, b, c)'
114
+ expect(obj.docstring).to eq 'A property that is awesome.'
115
+ expect(obj.tag(:param).name).to eq 'a'
116
+ expect(obj.tag(:param).text).to eq 'first parameter'
117
+ expect(obj.tag(:return).types).to eq ['String']
118
+ expect(obj.tag(:return).text).to eq 'the property name'
119
119
  end
120
120
 
121
- it "should allow reuse of named macros" do
121
+ it "allows reuse of named macros" do
122
122
  obj = Registry.at('Foo#age')
123
- obj.should_not be_nil
124
- obj.source.should == 'property :age, Fixnum, :value'
125
- obj.signature.should == 'def age(value)'
126
- obj.docstring.should == 'A property that is awesome.'
127
- obj.tag(:param).name.should == 'value'
128
- obj.tag(:param).text.should == 'first parameter'
129
- obj.tag(:return).types.should == ['Fixnum']
130
- obj.tag(:return).text.should == 'the property age'
123
+ expect(obj).not_to be nil
124
+ expect(obj.source).to eq 'property :age, Fixnum, :value'
125
+ expect(obj.signature).to eq 'def age(value)'
126
+ expect(obj.docstring).to eq 'A property that is awesome.'
127
+ expect(obj.tag(:param).name).to eq 'value'
128
+ expect(obj.tag(:param).text).to eq 'first parameter'
129
+ expect(obj.tag(:return).types).to eq ['Fixnum']
130
+ expect(obj.tag(:return).text).to eq 'the property age'
131
131
  end
132
132
 
133
- it "should know about method information on DSL with macro expansion" do
134
- Registry.at('Foo#right_name').should_not be_nil
135
- Registry.at('Foo#right_name').source.should ==
136
- 'implicit_with_different_method_name :wrong, :right'
137
- Registry.at('Foo#wrong_name').should be_nil
133
+ it "knows about method information on DSL with macro expansion" do
134
+ expect(Registry.at('Foo#right_name')).not_to be nil
135
+ expect(Registry.at('Foo#right_name').source).to eq 'implicit_with_different_method_name :wrong, :right'
136
+ expect(Registry.at('Foo#wrong_name')).to be nil
138
137
  end
139
138
 
140
- it "should use attached macros" do
139
+ it "uses attached macros" do
141
140
  macro = CodeObjects::MacroObject.find('parser')
142
- macro.macro_data.should == "@!method $1(opts = {})\n@return NOTHING!"
143
- macro.should_not be_nil
144
- macro.should be_attached
145
- macro.method_object.should == P('Foo.parser')
141
+ expect(macro.macro_data).to eq "@!method $1(opts = {})\n@return NOTHING!"
142
+ expect(macro).not_to be nil
143
+ expect(macro).to be_attached
144
+ expect(macro.method_object).to eq P('Foo.parser')
146
145
  obj = Registry.at('Foo#c_parser')
147
- obj.should_not be_nil
148
- obj.docstring.should == ""
149
- obj.signature.should == "def c_parser(opts = {})"
150
- obj.docstring.tag(:return).text.should == "NOTHING!"
146
+ expect(obj).not_to be nil
147
+ expect(obj.docstring).to eq ""
148
+ expect(obj.signature).to eq "def c_parser(opts = {})"
149
+ expect(obj.docstring.tag(:return).text).to eq "NOTHING!"
151
150
  end
152
151
 
153
- it "should append docstring on DSL method to attached macro" do
152
+ it "appends docstring on DSL method to attached macro" do
154
153
  obj = Registry.at('Foo#d_parser')
155
- obj.should_not be_nil
156
- obj.docstring.should == "Another docstring"
157
- obj.signature.should == "def d_parser(opts = {})"
158
- obj.docstring.tag(:return).text.should == "NOTHING!"
154
+ expect(obj).not_to be nil
155
+ expect(obj.docstring).to eq "Another docstring"
156
+ expect(obj.signature).to eq "def d_parser(opts = {})"
157
+ expect(obj.docstring.tag(:return).text).to eq "NOTHING!"
159
158
  end
160
159
 
161
- it "should only use attached macros on methods defined in inherited hierarchy" do
162
- Registry.at('Bar#x_parser').should be_nil
163
- Registry.at('Baz#y_parser').should_not be_nil
160
+ it "only uses attached macros on methods defined in inherited hierarchy" do
161
+ expect(Registry.at('Bar#x_parser')).to be nil
162
+ expect(Registry.at('Baz#y_parser')).not_to be nil
164
163
  end
165
164
 
166
- it "should look through mixins for attached macros" do
165
+ it "looks through mixins for attached macros" do
167
166
  meth = Registry.at('Baz#mixin_method')
168
- meth.should_not be_nil
169
- meth.docstring.should == 'DSL method mixin_method'
167
+ expect(meth).not_to be nil
168
+ expect(meth.docstring).to eq 'DSL method mixin_method'
170
169
  end
171
170
 
172
- it "should handle top-level DSL methods" do
171
+ it "handles top-level DSL methods" do
173
172
  obj = Registry.at('#my_other_method')
174
- obj.should_not be_nil
175
- obj.docstring.should == "Docstring for method"
173
+ expect(obj).not_to be nil
174
+ expect(obj.docstring).to eq "Docstring for method"
176
175
  end
177
176
 
178
- it "should handle Constant.foo syntax" do
177
+ it "handles Constant.foo syntax" do
179
178
  obj = Registry.at('#beep')
180
- obj.should_not be_nil
181
- obj.signature.should == 'def beep(a, b, c)'
179
+ expect(obj).not_to be nil
180
+ expect(obj.signature).to eq 'def beep(a, b, c)'
182
181
  end
183
182
 
184
- it "should expand attached macros in first DSL method" do
185
- Registry.at('DSLMethods#foo').docstring.should == "Returns String for foo"
186
- Registry.at('DSLMethods#bar').docstring.should == "Returns Integer for bar"
183
+ it "expands attached macros in first DSL method" do
184
+ expect(Registry.at('DSLMethods#foo').docstring).to eq "Returns String for foo"
185
+ expect(Registry.at('DSLMethods#bar').docstring).to eq "Returns Integer for bar"
187
186
  end
188
187
 
189
- it "should not detect implicit macros with invalid method names" do
188
+ it "does not detect implicit macros with invalid method names" do
190
189
  undoc_error <<-eof
191
190
  ##
192
191
  # IMPLICIT METHOD THAT SHOULD
@@ -22,4 +22,7 @@ MyEmptyStruct = Struct.new
22
22
  #
23
23
  # @attr [String] bar An attr
24
24
  # @attr [Number] baz Another attr
25
- DocstringStruct = Struct.new(:bar, :baz)
25
+ # @!attribute new_syntax
26
+ # Attribute defined with the new syntax
27
+ # @return [Symbol] something usefull
28
+ DocstringStruct = Struct.new(:bar, :baz, :new_syntax)
@@ -25,8 +25,12 @@ class Testing
25
25
  def Foo; end
26
26
  private :Foo
27
27
 
28
+ private def decpriv; end
29
+
28
30
  private
29
31
 
30
32
  class Bar; end
31
33
  module Baz; end
34
+
35
+ private :not_exist!
32
36
  end
@@ -3,46 +3,46 @@ require File.dirname(__FILE__) + '/spec_helper'
3
3
  describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}ExceptionHandler" do
4
4
  before(:all) { parse_file :exception_handler_001, __FILE__ }
5
5
 
6
- it "should not document an exception outside of a method" do
7
- P('Testing').has_tag?(:raise).should == false
6
+ it "does not document an exception outside of a method" do
7
+ expect(P('Testing').has_tag?(:raise)).to be false
8
8
  end
9
9
 
10
- it "should document a valid raise" do
11
- P('Testing#mymethod').tag(:raise).types.should == ['ArgumentError']
10
+ it "documents a valid raise" do
11
+ expect(P('Testing#mymethod').tag(:raise).types).to eq ['ArgumentError']
12
12
  end
13
13
 
14
- it "should only document non-dynamic raises" do
15
- P('Testing#mymethod2').tag(:raise).should be_nil
16
- P('Testing#mymethod6').tag(:raise).should be_nil
17
- P('Testing#mymethod7').tag(:raise).should be_nil
14
+ it "only documents non-dynamic raises" do
15
+ expect(P('Testing#mymethod2').tag(:raise)).to be nil
16
+ expect(P('Testing#mymethod6').tag(:raise)).to be nil
17
+ expect(P('Testing#mymethod7').tag(:raise)).to be nil
18
18
  end
19
19
 
20
- it "should treat ConstantName.new as a valid exception class" do
21
- P('Testing#mymethod8').tag(:raise).types.should == ['ExceptionClass']
20
+ it "treats ConstantName.new as a valid exception class" do
21
+ expect(P('Testing#mymethod8').tag(:raise).types).to eq ['ExceptionClass']
22
22
  end
23
23
 
24
- it "should not document a method with an existing @raise tag" do
25
- P('Testing#mymethod3').tag(:raise).types.should == ['A']
24
+ it "does not document a method with an existing @raise tag" do
25
+ expect(P('Testing#mymethod3').tag(:raise).types).to eq ['A']
26
26
  end
27
27
 
28
- it "should only document the first raise message of a method (limitation of exception handler)" do
29
- P('Testing#mymethod4').tag(:raise).types.should == ['A']
28
+ it "only documents the first raise message of a method (limitation of exception handler)" do
29
+ expect(P('Testing#mymethod4').tag(:raise).types).to eq ['A']
30
30
  end
31
31
 
32
- it "should handle complex class names" do
33
- P('Testing#mymethod5').tag(:raise).types.should == ['YARD::Parser::UndocumentableError']
32
+ it "handles complex class names" do
33
+ expect(P('Testing#mymethod5').tag(:raise).types).to eq ['YARD::Parser::UndocumentableError']
34
34
  end
35
35
 
36
- it "should ignore any raise calls on a receiver" do
37
- P('Testing#mymethod9').tag(:raise).should be_nil
36
+ it "ignores any raise calls on a receiver" do
37
+ expect(P('Testing#mymethod9').tag(:raise)).to be nil
38
38
  end
39
39
 
40
- it "should handle raise expressions that are method calls" do
41
- P('Testing#mymethod10').tag(:raise).should be_nil
42
- P('Testing#mymethod11').tag(:raise).should be_nil
40
+ it "handles raise expressions that are method calls" do
41
+ expect(P('Testing#mymethod10').tag(:raise)).to be nil
42
+ expect(P('Testing#mymethod11').tag(:raise)).to be nil
43
43
  end
44
44
 
45
- it "should ignore empty raise call" do
46
- P('Testing#mymethod12').tag(:raise).should be_nil
45
+ it "ignores empty raise call" do
46
+ expect(P('Testing#mymethod12').tag(:raise)).to be nil
47
47
  end
48
48
  end
@@ -3,21 +3,21 @@ require File.dirname(__FILE__) + '/spec_helper'
3
3
  describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}ExtendHandler" do
4
4
  before(:all) { parse_file :extend_handler_001, __FILE__ }
5
5
 
6
- it "should include modules at class scope" do
7
- Registry.at(:B).class_mixins.should == [P(:A)]
8
- Registry.at(:B).instance_mixins.should be_empty
6
+ it "includes modules at class scope" do
7
+ expect(Registry.at(:B).class_mixins).to eq [P(:A)]
8
+ expect(Registry.at(:B).instance_mixins).to be_empty
9
9
  end
10
10
 
11
- it "should handle a module extending itself" do
12
- Registry.at(:C).class_mixins.should == [P(:C)]
13
- Registry.at(:C).instance_mixins.should be_empty
11
+ it "handles a module extending itself" do
12
+ expect(Registry.at(:C).class_mixins).to eq [P(:C)]
13
+ expect(Registry.at(:C).instance_mixins).to be_empty
14
14
  end
15
15
 
16
- it "should extend module with correct namespace" do
17
- Registry.at('Q::R::S').class_mixins.first.path.should == 'A'
16
+ it "extends module with correct namespace" do
17
+ expect(Registry.at('Q::R::S').class_mixins.first.path).to eq 'A'
18
18
  end
19
19
 
20
- it "should not allow extending self if object is a class" do
20
+ it "does not allow extending self if object is a class" do
21
21
  undoc_error "class Foo; extend self; end"
22
22
  end
23
23
  end
@@ -10,58 +10,58 @@ describe YARD::Handlers::Ruby::Legacy::Base, "#tokval" do
10
10
  @handler.send(:tokval, TokenList.new(code).first, *types)
11
11
  end
12
12
 
13
- it "should return the String's value without quotes" do
14
- tokval('"hello"').should == "hello"
13
+ it "returns the String's value without quotes" do
14
+ expect(tokval('"hello"')).to eq "hello"
15
15
  end
16
16
 
17
- it "should not allow interpolated strings with TkSTRING" do
18
- tokval('"#{c}"', RubyToken::TkSTRING).should be_nil
17
+ it "does not allow interpolated strings with TkSTRING" do
18
+ expect(tokval('"#{c}"', RubyToken::TkSTRING)).to be nil
19
19
  end
20
20
 
21
- it "should return a Symbol's value as a String (as if it was done via :name.to_sym)" do
22
- tokval(':sym').should == :sym
21
+ it "returns a Symbol's value as a String (as if it was done via :name.to_sym)" do
22
+ expect(tokval(':sym')).to eq :sym
23
23
  end
24
24
 
25
- it "should return nil for any non accepted type" do
26
- tokval('identifier').should be_nil
27
- tokval(':sym', RubyToken::TkId).should be_nil
25
+ it "returns nil for any non accepted type" do
26
+ expect(tokval('identifier')).to be nil
27
+ expect(tokval(':sym', RubyToken::TkId)).to be nil
28
28
  end
29
29
 
30
- it "should accept TkVal tokens by default" do
31
- tokval('2.5').should == 2.5
32
- tokval(':sym').should == :sym
30
+ it "accepts TkVal tokens by default" do
31
+ expect(tokval('2.5')).to eq 2.5
32
+ expect(tokval(':sym')).to eq :sym
33
33
  end
34
34
 
35
- it "should accept any ID type if TkId is set" do
36
- tokval('variable', RubyToken::TkId).should == "variable"
37
- tokval('CONSTANT', RubyToken::TkId).should == "CONSTANT"
35
+ it "accepts any ID type if TkId is set" do
36
+ expect(tokval('variable', RubyToken::TkId)).to eq "variable"
37
+ expect(tokval('CONSTANT', RubyToken::TkId)).to eq "CONSTANT"
38
38
  end
39
39
 
40
- it "should allow extra token types to be accepted" do
41
- tokval('2.5', RubyToken::TkFLOAT).should == 2.5
42
- tokval('2', RubyToken::TkFLOAT).should be_nil
43
- tokval(':symbol', RubyToken::TkFLOAT).should be_nil
40
+ it "allows extra token types to be accepted" do
41
+ expect(tokval('2.5', RubyToken::TkFLOAT)).to eq 2.5
42
+ expect(tokval('2', RubyToken::TkFLOAT)).to be nil
43
+ expect(tokval(':symbol', RubyToken::TkFLOAT)).to be nil
44
44
  end
45
45
 
46
- it "should allow :string for any string type" do
47
- tokval('"hello"', :string).should == "hello"
48
- tokval('"#{c}"', :string).should == '#{c}'
46
+ it "allows :string for any string type" do
47
+ expect(tokval('"hello"', :string)).to eq "hello"
48
+ expect(tokval('"#{c}"', :string)).to eq '#{c}'
49
49
  end
50
50
 
51
- it "should not include interpolated strings when using :attr" do
52
- tokval('"#{c}"', :attr).should be_nil
51
+ it "does not include interpolated strings when using :attr" do
52
+ expect(tokval('"#{c}"', :attr)).to be nil
53
53
  end
54
54
 
55
- it "should allow any number type with :number" do
56
- tokval('2.5', :number).should == 2.5
57
- tokval('2', :number).should == 2
55
+ it "allows any number type with :number" do
56
+ expect(tokval('2.5', :number)).to eq 2.5
57
+ expect(tokval('2', :number)).to eq 2
58
58
  end
59
59
 
60
- it "should should allow method names with :identifier" do
61
- tokval('methodname?', :identifier).should == "methodname?"
60
+ it "allows method names with :identifier" do
61
+ expect(tokval('methodname?', :identifier)).to eq "methodname?"
62
62
  end
63
63
 
64
- #it "should obey documentation expectations" do docspec end
64
+ #it "obeys documentation expectations" do docspec end
65
65
  end
66
66
 
67
67
  describe YARD::Handlers::Base, "#tokval_list" do
@@ -71,58 +71,58 @@ describe YARD::Handlers::Base, "#tokval_list" do
71
71
  @handler.send(:tokval_list, TokenList.new(code), *types)
72
72
  end
73
73
 
74
- it "should return the list of tokvalues" do
75
- tokval_list(":a, :b, \"\#{c}\", 'd'", :attr).should == [:a, :b, 'd']
76
- tokval_list(":a, :b, File.read(\"\#{c}\", ['w']), :d",
77
- RubyToken::Token).should == [:a, :b, 'File.read("#{c}", [\'w\'])', :d]
74
+ it "returns the list of tokvalues" do
75
+ expect(tokval_list(":a, :b, \"\#{c}\", 'd'", :attr)).to eq [:a, :b, 'd']
76
+ expect(tokval_list(":a, :b, File.read(\"\#{c}\", ['w']), :d",
77
+ RubyToken::Token)).to eq [:a, :b, 'File.read("#{c}", [\'w\'])', :d]
78
78
  end
79
79
 
80
- it "should try to skip any invalid tokens" do
81
- tokval_list(":a, :b, \"\#{c}\", :d", :attr).should == [:a, :b, :d]
82
- tokval_list(":a, :b, File.read(\"\#{c}\", 'w', File.open { }), :d", :attr).should == [:a, :b, :d]
83
- tokval_list("CONST1, identifier, File.read(\"\#{c}\", 'w', File.open { }), CONST2",
84
- RubyToken::TkId).should == ['CONST1', 'identifier', 'CONST2']
80
+ it "tries to skip any invalid tokens" do
81
+ expect(tokval_list(":a, :b, \"\#{c}\", :d", :attr)).to eq [:a, :b, :d]
82
+ expect(tokval_list(":a, :b, File.read(\"\#{c}\", 'w', File.open { }), :d", :attr)).to eq [:a, :b, :d]
83
+ expect(tokval_list("CONST1, identifier, File.read(\"\#{c}\", 'w', File.open { }), CONST2",
84
+ RubyToken::TkId)).to eq ['CONST1', 'identifier', 'CONST2']
85
85
  end
86
86
 
87
- it "should ignore a token if another invalid token is read before a comma" do
88
- tokval_list(":a, :b XYZ, :c", RubyToken::TkSYMBOL).should == [:a, :c]
87
+ it "ignores a token if another invalid token is read before a comma" do
88
+ expect(tokval_list(":a, :b XYZ, :c", RubyToken::TkSYMBOL)).to eq [:a, :c]
89
89
  end
90
90
 
91
- it "should stop on most keywords" do
92
- tokval_list(':a rescue :x == 5', RubyToken::Token).should == [:a]
91
+ it "stops on most keywords" do
92
+ expect(tokval_list(':a rescue :x == 5', RubyToken::Token)).to eq [:a]
93
93
  end
94
94
 
95
- it "should handle ignore parentheses that begin the token list" do
96
- tokval_list('(:a, :b, :c)', :attr).should == [:a, :b, :c]
95
+ it "handles ignore parentheses that begin the token list" do
96
+ expect(tokval_list('(:a, :b, :c)', :attr)).to eq [:a, :b, :c]
97
97
  end
98
98
 
99
- it "should end when a closing parenthesis was found" do
100
- tokval_list(':a, :b, :c), :d', :attr).should == [:a, :b, :c]
99
+ it "ends when a closing parenthesis was found" do
100
+ expect(tokval_list(':a, :b, :c), :d', :attr)).to eq [:a, :b, :c]
101
101
  end
102
102
 
103
- it "should ignore parentheses around items in a list" do
104
- tokval_list(':a, (:b), :c, (:d TEST), :e, [:f], :g', :attr).should == [:a, :b, :c, :e, :g]
105
- tokval_list(':a, (((:f)))', :attr).should == [:a, :f]
106
- tokval_list(':a, ([:f]), :c)', RubyToken::Token).should == [:a, '[:f]', :c]
103
+ it "ignores parentheses around items in a list" do
104
+ expect(tokval_list(':a, (:b), :c, (:d TEST), :e, [:f], :g', :attr)).to eq [:a, :b, :c, :e, :g]
105
+ expect(tokval_list(':a, (((:f)))', :attr)).to eq [:a, :f]
106
+ expect(tokval_list(':a, ([:f]), :c)', RubyToken::Token)).to eq [:a, '[:f]', :c]
107
107
  end
108
108
 
109
- it "should not stop on a true/false/self keyword (cannot handle nil)" do
110
- tokval_list(':a, true, :b, self, false, :c, nil, File, super, if, XYZ',
111
- RubyToken::Token).should == [:a, true, :b, 'self', false, :c, 'File', 'super']
109
+ it "does not stop on a true/false/self keyword (cannot handle nil)" do
110
+ expect(tokval_list(':a, true, :b, self, false, :c, nil, File, super, if, XYZ',
111
+ RubyToken::Token)).to eq [:a, true, :b, 'self', false, :c, 'File', 'super']
112
112
  end
113
113
 
114
- it "should ignore invalid commas" do
115
- tokval_list(":a, :b, , :d").should == [:a, :b, :d]
114
+ it "ignores invalid commas" do
115
+ expect(tokval_list(":a, :b, , :d")).to eq [:a, :b, :d]
116
116
  end
117
117
 
118
- it "should return an empty list if no matches were found" do
119
- tokval_list('attr_accessor :x').should == []
118
+ it "returns an empty list if no matches were found" do
119
+ expect(tokval_list('attr_accessor :x')).to eq []
120
120
  end
121
121
 
122
- it "should treat {} as a valid value" do
122
+ it "treats {} as a valid value" do
123
123
  # FIXME: tokval_list destroys extra spaces surrounding the '=' in
124
124
  # this situation. This is technically a design flaw of the
125
125
  # tokval parser, but this is now the expected behaviour.
126
- tokval_list("opts = {}", :all).should == ["opts={}"]
126
+ expect(tokval_list("opts = {}", :all)).to eq ["opts={}"]
127
127
  end
128
128
  end