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
@@ -3,77 +3,77 @@ require File.dirname(__FILE__) + '/spec_helper'
3
3
  describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}AliasHandler" do
4
4
  before(:all) { parse_file :alias_handler_001, __FILE__ }
5
5
 
6
- it "should throw alias into namespace object list" do
7
- P(:A).aliases[P("A#b")].should == :a
6
+ it "throws alias into namespace object list" do
7
+ expect(P(:A).aliases[P("A#b")]).to eq :a
8
8
  end
9
9
 
10
10
  ['c', 'd?', '[]', '[]=', '-@', '%', '*', 'cstrkey', 'cstrmeth'].each do |a|
11
- it "should handle the Ruby 'alias' keyword syntax for method ##{a}" do
12
- P('A#' + a).should be_instance_of(CodeObjects::MethodObject)
13
- P('A#' + a).is_alias?.should be_true
11
+ it "handles the Ruby 'alias' keyword syntax for method ##{a}" do
12
+ expect(P('A#' + a)).to be_instance_of(CodeObjects::MethodObject)
13
+ expect(P('A#' + a).is_alias?).to be true
14
14
  end
15
15
  end
16
16
 
17
- it "should handle keywords as the alias name" do
18
- P('A#for').should be_instance_of(CodeObjects::MethodObject)
17
+ it "handles keywords as the alias name" do
18
+ expect(P('A#for')).to be_instance_of(CodeObjects::MethodObject)
19
19
  end
20
20
 
21
- it "should allow ConstantNames to be specified as aliases" do
22
- P('A#ConstantName').should be_instance_of(CodeObjects::MethodObject)
21
+ it "allows ConstantNames to be specified as aliases" do
22
+ expect(P('A#ConstantName')).to be_instance_of(CodeObjects::MethodObject)
23
23
  end
24
24
 
25
- it "should create a new method object for the alias" do
26
- P("A#b").should be_instance_of(CodeObjects::MethodObject)
25
+ it "creates a new method object for the alias" do
26
+ expect(P("A#b")).to be_instance_of(CodeObjects::MethodObject)
27
27
  end
28
28
 
29
- it "should pull the method into the current class if it's from another one" do
30
- P(:B).aliases[P("B#q")].should == :x
31
- P(:B).aliases[P("B#r?")].should == :x
29
+ it "pulls the method into the current class if it's from another one" do
30
+ expect(P(:B).aliases[P("B#q")]).to eq :x
31
+ expect(P(:B).aliases[P("B#r?")]).to eq :x
32
32
  end
33
33
 
34
- it "should gracefully fail to pull a method in if the original method cannot be found" do
35
- P(:B).aliases[P("B#s")].should == :to_s
34
+ it "gracefully fails to pull a method in if the original method cannot be found" do
35
+ expect(P(:B).aliases[P("B#s")]).to eq :to_s
36
36
  end
37
37
 
38
- it "should allow complex Ruby expressions after the alias parameters" do
39
- P(:B).aliases[P("B#t")].should == :inspect
38
+ it "allows complex Ruby expressions after the alias parameters" do
39
+ expect(P(:B).aliases[P("B#t")]).to eq :inspect
40
40
  end
41
41
 
42
- it "should show up in #is_alias? for method" do
43
- P("B#t").is_alias?.should == true
44
- P('B#r?').is_alias?.should == true
42
+ it "shows up in #is_alias? for method" do
43
+ expect(P("B#t").is_alias?).to be true
44
+ expect(P('B#r?').is_alias?).to be true
45
45
  end
46
46
 
47
- it "should allow operators and keywords to be specified as symbols" do
48
- P('B#<<').should be_instance_of(CodeObjects::MethodObject)
49
- P('B#for').should be_instance_of(CodeObjects::MethodObject)
47
+ it "allows operators and keywords to be specified as symbols" do
48
+ expect(P('B#<<')).to be_instance_of(CodeObjects::MethodObject)
49
+ expect(P('B#for')).to be_instance_of(CodeObjects::MethodObject)
50
50
  end
51
51
 
52
- it "should handle keywords in alias names" do
53
- P('B#do').is_alias?.should == true
54
- P('B#x2').is_alias?.should == true
55
- P(:B).aliases[P('B#do')].should == :x
56
- P(:B).aliases[P('B#x2')].should == :do
52
+ it "handles keywords in alias names" do
53
+ expect(P('B#do').is_alias?).to be true
54
+ expect(P('B#x2').is_alias?).to be true
55
+ expect(P(:B).aliases[P('B#do')]).to eq :x
56
+ expect(P(:B).aliases[P('B#x2')]).to eq :do
57
57
  end
58
58
 
59
- it "should handle quoted symbols" do
59
+ it "handles quoted symbols" do
60
60
  foo = Registry.at('A#foo')
61
- foo.should_not be_nil
62
- foo.should be_is_alias
63
- Registry.at('A').aliases[foo].should == :a
61
+ expect(foo).not_to be nil
62
+ expect(foo.is_alias?).to be true
63
+ expect(Registry.at('A').aliases[foo]).to eq :a
64
64
  end
65
65
 
66
- it "should prepend aliases object's docstring to comments" do
67
- Registry.at('D#a').tag(:return).types.should == ['Numeric']
68
- Registry.at('D#b').tag(:return).types.should == ['String']
69
- Registry.at('D#b').docstring.should == "Foo bar"
66
+ it "prepends aliases object's docstring to comments" do
67
+ expect(Registry.at('D#a').tag(:return).types).to eq ['Numeric']
68
+ expect(Registry.at('D#b').tag(:return).types).to eq ['String']
69
+ expect(Registry.at('D#b').docstring).to eq "Foo bar"
70
70
  end
71
71
 
72
- it "should raise an UndocumentableError if only one parameter is passed" do
72
+ it "raises an UndocumentableError if only one parameter is passed" do
73
73
  undoc_error "alias_method :q"
74
74
  end
75
75
 
76
- it "should raise an UndocumentableError if the parameter is not a Symbol or String" do
76
+ it "raises an UndocumentableError if the parameter is not a Symbol or String" do
77
77
  undoc_error "alias_method CONST, Something"
78
78
  undoc_error "alias_method variable, ClassName"
79
79
  undoc_error "alias_method variable, other_variable"
@@ -6,89 +6,89 @@ describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}AttributeHandl
6
6
  def read_write(namespace, name, read, write, scope = :instance)
7
7
  rname, wname = namespace.to_s+"#"+name.to_s, namespace.to_s+"#"+name.to_s+"="
8
8
  if read
9
- Registry.at(rname).should be_instance_of(CodeObjects::MethodObject)
9
+ expect(Registry.at(rname)).to be_instance_of(CodeObjects::MethodObject)
10
10
  else
11
- Registry.at(rname).should == nil
11
+ expect(Registry.at(rname)).to eq nil
12
12
  end
13
13
 
14
14
  if write
15
- Registry.at(wname).should be_kind_of(CodeObjects::MethodObject)
15
+ expect(Registry.at(wname)).to be_kind_of(CodeObjects::MethodObject)
16
16
  else
17
- Registry.at(wname).should == nil
17
+ expect(Registry.at(wname)).to eq nil
18
18
  end
19
19
 
20
20
  attrs = Registry.at(namespace).attributes[scope][name]
21
- attrs[:read].should == (read ? Registry.at(rname) : nil)
22
- attrs[:write].should == (write ? Registry.at(wname) : nil)
21
+ expect(attrs[:read]).to eq (read ? Registry.at(rname) : nil)
22
+ expect(attrs[:write]).to eq (write ? Registry.at(wname) : nil)
23
23
  end
24
24
 
25
- it "should parse attributes inside modules too" do
26
- Registry.at("A#x=").should_not == nil
25
+ it "parses attributes inside modules too" do
26
+ expect(Registry.at("A#x=")).not_to eq nil
27
27
  end
28
28
 
29
- it "should parse 'attr'" do
29
+ it "parses 'attr'" do
30
30
  read_write(:B, :a, true, true)
31
31
  read_write(:B, :a2, true, false)
32
32
  read_write(:B, "a3", true, false)
33
33
  end
34
34
 
35
- it "should parse 'attr_reader'" do
35
+ it "parses 'attr_reader'" do
36
36
  read_write(:B, :b, true, false)
37
37
  end
38
38
 
39
- it "should parse 'attr_writer'" do
39
+ it "parses 'attr_writer'" do
40
40
  read_write(:B, :e, false, true)
41
41
  end
42
42
 
43
- it "should parse 'attr_accessor'" do
43
+ it "parses 'attr_accessor'" do
44
44
  read_write(:B, :f, true, true)
45
45
  end
46
46
 
47
- it "should parse a list of attributes" do
47
+ it "parses a list of attributes" do
48
48
  read_write(:B, :b, true, false)
49
49
  read_write(:B, :c, true, false)
50
50
  read_write(:B, :d, true, false)
51
51
  end
52
52
 
53
- it "should have a default docstring if one is not supplied" do
54
- Registry.at("B#f=").docstring.should_not be_empty
53
+ it "has a default docstring if one is not supplied" do
54
+ expect(Registry.at("B#f=").docstring).not_to be_empty
55
55
  end
56
56
 
57
- it "should set the correct docstring if one is supplied" do
58
- Registry.at("B#b").docstring.should == "Docstring"
59
- Registry.at("B#c").docstring.should == "Docstring"
60
- Registry.at("B#d").docstring.should == "Docstring"
57
+ it "sets the correct docstring if one is supplied" do
58
+ expect(Registry.at("B#b").docstring).to eq "Docstring"
59
+ expect(Registry.at("B#c").docstring).to eq "Docstring"
60
+ expect(Registry.at("B#d").docstring).to eq "Docstring"
61
61
  end
62
62
 
63
- it "should be able to differentiate between class and instance attributes" do
64
- P('B').class_attributes[:z][:read].scope.should == :class
65
- P('B').instance_attributes[:z][:read].scope.should == :instance
63
+ it "is able to differentiate between class and instance attributes" do
64
+ expect(P('B').class_attributes[:z][:read].scope).to eq :class
65
+ expect(P('B').instance_attributes[:z][:read].scope).to eq :instance
66
66
  end
67
67
 
68
- it "should respond true in method's #is_attribute?" do
69
- P('B#a').is_attribute?.should == true
70
- P('B#a=').is_attribute?.should == true
68
+ it "responds true in method's #is_attribute?" do
69
+ expect(P('B#a').is_attribute?).to be true
70
+ expect(P('B#a=').is_attribute?).to be true
71
71
  end
72
72
 
73
- it "should not return true for #is_explicit? in created methods" do
73
+ it "does not return true for #is_explicit? in created methods" do
74
74
  Registry.at(:B).meths.each do |meth|
75
- meth.is_explicit?.should == false
75
+ expect(meth.is_explicit?).to be false
76
76
  end
77
77
  end
78
78
 
79
- it "should handle attr call with no arguments" do
80
- lambda { StubbedSourceParser.parse_string "attr" }.should_not raise_error
79
+ it "handles attr call with no arguments" do
80
+ expect { StubbedSourceParser.parse_string "attr" }.not_to raise_error
81
81
  end
82
82
 
83
- it "should add existing reader method as part of attr_writer combo" do
84
- Registry.at('C#foo=').attr_info[:read].should == Registry.at('C#foo')
83
+ it "adds existing reader method as part of attr_writer combo" do
84
+ expect(Registry.at('C#foo=').attr_info[:read]).to eq Registry.at('C#foo')
85
85
  end
86
86
 
87
- it "should add existing writer method as part of attr_reader combo" do
88
- Registry.at('C#foo').attr_info[:write].should == Registry.at('C#foo=')
87
+ it "adds existing writer method as part of attr_reader combo" do
88
+ expect(Registry.at('C#foo').attr_info[:write]).to eq Registry.at('C#foo=')
89
89
  end
90
90
 
91
- it "should maintain visibility for attr_reader" do
92
- Registry.at('D#parser').visibility.should == :protected
91
+ it "maintains visibility for attr_reader" do
92
+ expect(Registry.at('D#parser').visibility).to eq :protected
93
93
  end
94
94
  end
@@ -6,51 +6,51 @@ include Parser
6
6
  describe YARD::Handlers::Base do
7
7
  describe "#handles and inheritance" do
8
8
  before do
9
- Handlers::Base.stub!(:inherited)
9
+ allow(Handlers::Base).to receive(:inherited)
10
10
  end
11
11
 
12
- it "should keep track of subclasses" do
13
- Handlers::Base.should_receive(:inherited).once
12
+ it "keeps track of subclasses" do
13
+ expect(Handlers::Base).to receive(:inherited).once
14
14
  class TestHandler < Handlers::Base; end
15
15
  end
16
16
 
17
- it "should raise NotImplementedError if process is called on a class with no #process" do
17
+ it "raises NotImplementedError if process is called on a class with no #process" do
18
18
  class TestNotImplementedHandler < Handlers::Base
19
19
  end
20
20
 
21
- lambda { TestNotImplementedHandler.new(0, 0).process }.should raise_error(NotImplementedError)
21
+ expect { TestNotImplementedHandler.new(0, 0).process }.to raise_error(NotImplementedError)
22
22
  end
23
23
 
24
- it "should allow multiple handles arguments" do
25
- Handlers::Base.should_receive(:inherited).once
24
+ it "allows multiple handles arguments" do
25
+ expect(Handlers::Base).to receive(:inherited).once
26
26
  class TestHandler1 < Handlers::Base
27
27
  handles :a, :b, :c
28
28
  end
29
- TestHandler1.handlers.should == [:a, :b, :c]
29
+ expect(TestHandler1.handlers).to eq [:a, :b, :c]
30
30
  end
31
31
 
32
- it "should allow multiple handles calls" do
33
- Handlers::Base.should_receive(:inherited).once
32
+ it "allows multiple handles calls" do
33
+ expect(Handlers::Base).to receive(:inherited).once
34
34
  class TestHandler2 < Handlers::Base
35
35
  handles :a
36
36
  handles :b
37
37
  handles :c
38
38
  end
39
- TestHandler2.handlers.should == [:a, :b, :c]
39
+ expect(TestHandler2.handlers).to eq [:a, :b, :c]
40
40
  end
41
41
  end
42
42
 
43
- describe '#abort! (and HandlerAborted)' do
44
- it 'should allow HandlerAborted to be raised' do
43
+ describe "#abort! (and HandlerAborted)" do
44
+ it "allows HandlerAborted to be raised" do
45
45
  class AbortHandler1 < Handlers::Ruby::Base
46
46
  process { abort! }
47
47
  end
48
- lambda { AbortHandler1.new(nil, nil).process }.should raise_error(HandlerAborted)
48
+ expect { AbortHandler1.new(nil, nil).process }.to raise_error(HandlerAborted)
49
49
  end
50
50
  end
51
51
 
52
- describe 'transitive tags' do
53
- it "should add transitive tags to children" do
52
+ describe "transitive tags" do
53
+ it "adds transitive tags to children" do
54
54
  Registry.clear
55
55
  YARD.parse_string <<-eof
56
56
  # @since 1.0
@@ -61,15 +61,15 @@ describe YARD::Handlers::Base do
61
61
  def bar; end
62
62
  end
63
63
  eof
64
- Registry.at('A').tag(:since).text.should == "1.0"
65
- Registry.at('A#foo').tag(:since).text.should == "1.0"
66
- Registry.at('A#bar').tag(:since).text.should == "1.1"
67
- Registry.at('A#bar').tag(:author).should be_nil
64
+ expect(Registry.at('A').tag(:since).text).to eq "1.0"
65
+ expect(Registry.at('A#foo').tag(:since).text).to eq "1.0"
66
+ expect(Registry.at('A#bar').tag(:since).text).to eq "1.1"
67
+ expect(Registry.at('A#bar').tag(:author)).to be nil
68
68
  end
69
69
  end
70
70
 
71
- describe 'sharing global state' do
72
- it "should allow globals to share global state among handlers" do
71
+ describe "sharing global state" do
72
+ it "allows globals to share global state among handlers" do
73
73
  class GlobalStateHandler1 < Handlers::Ruby::Base
74
74
  class << self; attr_accessor :state end
75
75
  handles :class
@@ -84,64 +84,73 @@ describe YARD::Handlers::Base do
84
84
 
85
85
  2.times do
86
86
  YARD.parse_string 'class Foo; end; def foo; end'
87
- GlobalStateHandler1.state.should == nil
88
- GlobalStateHandler2.state.should == :bar
87
+ expect(GlobalStateHandler1.state).to eq nil
88
+ expect(GlobalStateHandler2.state).to eq :bar
89
89
  end
90
90
  end
91
91
  end if HAVE_RIPPER
92
92
 
93
- describe '#push_state' do
93
+ describe "#push_state" do
94
94
  def process(klass)
95
95
  state = OpenStruct.new(:namespace => "ROOT", :scope => :instance, :owner => "ROOT")
96
96
  klass.new(state, nil).process
97
97
  end
98
98
 
99
- it "should push and return all old state info after block" do
99
+ it "pushes and return all old state info after block" do
100
100
  class PushStateHandler1 < Handlers::Base
101
+ include RSpec::Matchers
102
+ RSpec::Expectations::Syntax.enable_expect(self)
103
+
101
104
  def process
102
105
  push_state(:namespace => "FOO", :scope => :class, :owner => "BAR") do
103
- namespace.should == "FOO"
104
- scope.should == :class
105
- owner.should == "BAR"
106
+ expect(namespace).to eq "FOO"
107
+ expect(scope).to eq :class
108
+ expect(owner).to eq "BAR"
106
109
  end
107
- namespace.should == "ROOT"
108
- owner.should == "ROOT"
109
- scope.should == :instance
110
+ expect(namespace).to eq "ROOT"
111
+ expect(owner).to eq "ROOT"
112
+ expect(scope).to eq :instance
110
113
  end
111
114
  end
112
115
  process PushStateHandler1
113
116
  end
114
117
 
115
- it "should allow owner to be pushed individually" do
118
+ it "allows owner to be pushed individually" do
116
119
  class PushStateHandler2 < Handlers::Base
120
+ include RSpec::Matchers
121
+ RSpec::Expectations::Syntax.enable_expect(self)
122
+
117
123
  def process
118
124
  push_state(:owner => "BAR") do
119
- namespace.should == "ROOT"
120
- scope.should == :instance
121
- owner.should == "BAR"
125
+ expect(namespace).to eq "ROOT"
126
+ expect(scope).to eq :instance
127
+ expect(owner).to eq "BAR"
122
128
  end
123
- owner.should == "ROOT"
129
+ expect(owner).to eq "ROOT"
124
130
  end
125
131
  end
126
132
  process PushStateHandler2
127
133
  end
128
134
 
129
- it "should allow scope to be pushed individually" do
135
+ it "allows scope to be pushed individually" do
130
136
  class PushStateHandler3 < Handlers::Base
137
+ include RSpec::Matchers
138
+ RSpec::Expectations::Syntax.enable_expect(self)
139
+
131
140
  def process
132
141
  push_state(:scope => :foo) do
133
- namespace.should == "ROOT"
134
- scope.should == :foo
135
- owner.should == "ROOT"
142
+ expect(namespace).to eq "ROOT"
143
+ expect(scope).to eq :foo
144
+ expect(owner).to eq "ROOT"
136
145
  end
137
- scope.should == :instance
146
+ expect(scope).to eq :instance
138
147
  end
139
148
  end
140
149
  process PushStateHandler3
141
150
  end
142
151
  end
143
152
 
144
- describe '.in_file' do
153
+ describe ".in_file" do
145
154
  def parse(filename, parser_type, src = "class A; end")
146
155
  parser = Parser::SourceParser.new(parser_type)
147
156
  parser.instance_variable_set("@file", filename)
@@ -162,39 +171,39 @@ describe YARD::Handlers::Base do
162
171
 
163
172
  def test_handler(file, stmts, creates = true, parser_type = :ruby)
164
173
  Registry.clear
165
- Registry.at('#FOO').should be_nil
174
+ expect(Registry.at('#FOO')).to be nil
166
175
  create_handler(stmts, parser_type)
167
176
  parse(file, parser_type)
168
- Registry.at('#FOO').send(creates ? :should_not : :should, be_nil)
177
+ expect(Registry.at('#FOO')).send(creates ? :not_to : :to, be_nil)
169
178
  Handlers::Base.subclasses.delete_if {|k,v| k.to_s =~ /^InFileHandler/ }
170
179
  end
171
180
 
172
181
  [:ruby, :ruby18].each do |parser_type|
173
182
  next if parser_type == :ruby && LEGACY_PARSER
174
183
  describe "Parser type = #{parser_type.inspect}" do
175
- it "should allow handler to be specific to a file" do
184
+ it "allows handler to be specific to a file" do
176
185
  test_handler 'file_a.rb', 'in_file "file_a.rb"', true, parser_type
177
186
  end
178
187
 
179
- it "should ignore handler if filename does not match" do
188
+ it "ignores handler if filename does not match" do
180
189
  test_handler 'file_b.rb', 'in_file "file_a.rb"', false, parser_type
181
190
  end
182
191
 
183
- it "should only test filename part when given a String" do
192
+ it "only tests filename part when given a String" do
184
193
  test_handler '/path/to/file_a.rb', 'in_file "/to/file_a.rb"', false, parser_type
185
194
  end
186
195
 
187
- it "should test exact match for entire String" do
196
+ it "tests exact match for entire String" do
188
197
  test_handler 'file_a.rb', 'in_file "file"', false, parser_type
189
198
  end
190
199
 
191
- it "should allow a Regexp as argument and test against full path" do
200
+ it "allows a Regexp as argument and test against full path" do
192
201
  test_handler 'file_a.rbx', 'in_file /\.rbx$/', true, parser_type
193
202
  test_handler '/path/to/file_a.rbx', 'in_file /\/to\/file_/', true, parser_type
194
203
  test_handler '/path/to/file_a.rbx', 'in_file /^\/path/', true, parser_type
195
204
  end
196
205
 
197
- it "should allow multiple in_file declarations" do
206
+ it "allows multiple in_file declarations" do
198
207
  stmts = 'in_file "x"; in_file /y/; in_file "foo.rb"'
199
208
  test_handler 'foo.rb', stmts, true, parser_type
200
209
  test_handler 'xyzzy.rb', stmts, true, parser_type