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
@@ -37,65 +37,65 @@ describe YARD::CodeObjects::ModuleObject do
37
37
  @yard.class_mixins << @another
38
38
  end
39
39
 
40
- it "should list all methods (including mixin methods) via #meths" do
40
+ it "lists all methods (including mixin methods) via #meths" do
41
41
  meths = @yard.meths
42
- meths.should include(P("YARD#foo"))
43
- meths.should include(P("YARD#foo2"))
44
- meths.should include(P("YARD.bar"))
45
- meths.should include(P("SomeMod#mixmethod"))
46
- meths.should include(P("AnotherMod#fizz"))
42
+ expect(meths).to include(P("YARD#foo"))
43
+ expect(meths).to include(P("YARD#foo2"))
44
+ expect(meths).to include(P("YARD.bar"))
45
+ expect(meths).to include(P("SomeMod#mixmethod"))
46
+ expect(meths).to include(P("AnotherMod#fizz"))
47
47
  end
48
48
 
49
- it "should allow :visibility to be set" do
49
+ it "allows :visibility to be set" do
50
50
  meths = @yard.meths(:visibility => :public)
51
- meths.should_not include(P("YARD.bar"))
51
+ expect(meths).not_to include(P("YARD.bar"))
52
52
  meths = @yard.meths(:visibility => [:public, :private])
53
- meths.should include(P("YARD#foo"))
54
- meths.should include(P("YARD.bar"))
55
- meths.should_not include(P("YARD#foo2"))
53
+ expect(meths).to include(P("YARD#foo"))
54
+ expect(meths).to include(P("YARD.bar"))
55
+ expect(meths).not_to include(P("YARD#foo2"))
56
56
  end
57
57
 
58
- it "should only display class methods for :scope => :class" do
58
+ it "only displays class methods for :scope => :class" do
59
59
  meths = @yard.meths(:scope => :class)
60
- meths.should_not include(P("YARD#foo"))
61
- meths.should_not include(P("YARD#foo2"))
62
- meths.should_not include(P("SomeMod#mixmethod"))
63
- meths.should_not include(P("SomeMod.baz"))
64
- meths.should_not include(P("AnotherMod#fazz"))
65
- meths.should include(P("YARD.bar"))
66
- meths.should include(P("AnotherMod#fizz"))
60
+ expect(meths).not_to include(P("YARD#foo"))
61
+ expect(meths).not_to include(P("YARD#foo2"))
62
+ expect(meths).not_to include(P("SomeMod#mixmethod"))
63
+ expect(meths).not_to include(P("SomeMod.baz"))
64
+ expect(meths).not_to include(P("AnotherMod#fazz"))
65
+ expect(meths).to include(P("YARD.bar"))
66
+ expect(meths).to include(P("AnotherMod#fizz"))
67
67
  end
68
68
 
69
- it "should only display instance methods for :scope => :class" do
69
+ it "only displays instance methods for :scope => :class" do
70
70
  meths = @yard.meths(:scope => :instance)
71
- meths.should include(P("YARD#foo"))
72
- meths.should include(P("YARD#foo2"))
73
- meths.should include(P("SomeMod#mixmethod"))
74
- meths.should_not include(P("YARD.bar"))
75
- meths.should_not include(P("AnotherMod#fizz"))
71
+ expect(meths).to include(P("YARD#foo"))
72
+ expect(meths).to include(P("YARD#foo2"))
73
+ expect(meths).to include(P("SomeMod#mixmethod"))
74
+ expect(meths).not_to include(P("YARD.bar"))
75
+ expect(meths).not_to include(P("AnotherMod#fizz"))
76
76
  end
77
77
 
78
- it "should allow :included to be set" do
78
+ it "allows :included to be set" do
79
79
  meths = @yard.meths(:included => false)
80
- meths.should_not include(P("SomeMod#mixmethod"))
81
- meths.should_not include(P("AnotherMod#fizz"))
82
- meths.should include(P("YARD#foo"))
83
- meths.should include(P("YARD#foo2"))
84
- meths.should include(P("YARD.bar"))
80
+ expect(meths).not_to include(P("SomeMod#mixmethod"))
81
+ expect(meths).not_to include(P("AnotherMod#fizz"))
82
+ expect(meths).to include(P("YARD#foo"))
83
+ expect(meths).to include(P("YARD#foo2"))
84
+ expect(meths).to include(P("YARD.bar"))
85
85
  end
86
86
 
87
- it "should choose the method defined in the class over an included module" do
87
+ it "chooses the method defined in the class over an included module" do
88
88
  meths = @yard.meths
89
- meths.should_not include(P("SomeMod#xyz"))
90
- meths.should include(P("YARD#xyz"))
91
- meths.should_not include(P("AnotherMod#bar"))
92
- meths.should include(P("YARD.bar"))
89
+ expect(meths).not_to include(P("SomeMod#xyz"))
90
+ expect(meths).to include(P("YARD#xyz"))
91
+ expect(meths).not_to include(P("AnotherMod#bar"))
92
+ expect(meths).to include(P("YARD.bar"))
93
93
 
94
94
  meths = @other.meths
95
- meths.should include(P("SomeMod#xyz"))
95
+ expect(meths).to include(P("SomeMod#xyz"))
96
96
 
97
97
  meths = @another.meths
98
- meths.should include(P("AnotherMod#bar"))
98
+ expect(meths).to include(P("AnotherMod#bar"))
99
99
  end
100
100
  end
101
101
 
@@ -118,24 +118,24 @@ describe YARD::CodeObjects::ModuleObject do
118
118
  @mod5.instance_mixins << @proxy
119
119
  end
120
120
 
121
- it "should show only itself for an inheritance tree without included modules" do
122
- @mod1.inheritance_tree.should == [@mod1]
121
+ it "shows only itself for an inheritance tree without included modules" do
122
+ expect(@mod1.inheritance_tree).to eq [@mod1]
123
123
  end
124
124
 
125
- it "should show proper inheritance three when modules are included" do
126
- @mod1.inheritance_tree(true).should == [@mod1, @mod2, @mod3, @mod4]
125
+ it "shows proper inheritance tree when modules are included" do
126
+ expect(@mod1.inheritance_tree(true)).to eq [@mod1, @mod2, @mod3, @mod4]
127
127
  end
128
128
 
129
- it "should not list inheritance tree of proxy objects in inheritance tree" do
130
- @proxy.should_not_receive(:inheritance_tree)
131
- @mod5.instance_mixins.should == [@proxy]
129
+ it "does not list inheritance tree of proxy objects in inheritance tree" do
130
+ expect(@proxy).not_to receive(:inheritance_tree)
131
+ expect(@mod5.instance_mixins).to eq [@proxy]
132
132
  end
133
133
 
134
- it "should list class mixins in inheritance tree" do
134
+ it "lists class mixins in inheritance tree" do
135
135
  mod = ModuleObject.new(:root, :ClassMethods)
136
136
  recvmod = ModuleObject.new(:root, :ReceivingModule)
137
137
  recvmod.class_mixins << mod
138
- recvmod.inheritance_tree(true).should == [recvmod, mod]
138
+ expect(recvmod.inheritance_tree(true)).to eq [recvmod, mod]
139
139
  end
140
140
  end
141
141
  end
@@ -3,30 +3,30 @@ require File.dirname(__FILE__) + '/spec_helper'
3
3
  describe YARD::CodeObjects::NamespaceObject do
4
4
  before { Registry.clear }
5
5
 
6
- describe '#child' do
7
- it "should return the object matching the name passed in if argument is a Symbol" do
6
+ describe "#child" do
7
+ it "returns the object matching the name passed in if argument is a Symbol" do
8
8
  obj = NamespaceObject.new(nil, :YARD)
9
9
  other = NamespaceObject.new(obj, :Other)
10
- obj.child(:Other).should == other
11
- obj.child('Other').should == other
10
+ expect(obj.child(:Other)).to eq other
11
+ expect(obj.child('Other')).to eq other
12
12
  end
13
13
 
14
- it "should look for attributes matching the object if the argument is a Hash" do
14
+ it "looks for attributes matching the object if the argument is a Hash" do
15
15
  obj = NamespaceObject.new(nil, :YARD)
16
16
  NamespaceObject.new(obj, :NotOther)
17
17
  other = NamespaceObject.new(obj, :Other)
18
18
  other.somevalue = 2
19
- obj.child(:somevalue => 2).should == other
19
+ expect(obj.child(:somevalue => 2)).to eq other
20
20
  end
21
21
  end
22
22
 
23
- describe '#meths' do
24
- it "should return #meths even if parent is a Proxy" do
23
+ describe "#meths" do
24
+ it "returns #meths even if parent is a Proxy" do
25
25
  obj = NamespaceObject.new(P(:String), :YARD)
26
- obj.meths.should be_empty
26
+ expect(obj.meths).to be_empty
27
27
  end
28
28
 
29
- it "should not list included methods that are already defined in the namespace using #meths" do
29
+ it "does not list included methods that are already defined in the namespace using #meths" do
30
30
  a = ModuleObject.new(nil, :Mod1)
31
31
  ameth = MethodObject.new(a, :testing)
32
32
  b = ModuleObject.new(nil, :Mod2)
@@ -38,33 +38,33 @@ describe YARD::CodeObjects::NamespaceObject do
38
38
  c.class_mixins << b
39
39
 
40
40
  meths = c.meths
41
- meths.should include(bmeth)
42
- meths.should include(cmeth)
43
- meths.should include(cmeth2)
44
- meths.should_not include(ameth)
41
+ expect(meths).to include(bmeth)
42
+ expect(meths).to include(cmeth)
43
+ expect(meths).to include(cmeth2)
44
+ expect(meths).not_to include(ameth)
45
45
 
46
46
  meths = c.included_meths
47
- meths.should include(bmeth)
48
- meths.should_not include(ameth)
49
- meths.should_not include(cmeth)
50
- meths.should_not include(cmeth2)
47
+ expect(meths).to include(bmeth)
48
+ expect(meths).not_to include(ameth)
49
+ expect(meths).not_to include(cmeth)
50
+ expect(meths).not_to include(cmeth2)
51
51
  end
52
52
  end
53
53
 
54
- describe '#included_meths' do
55
- it "should list methods mixed into the class scope as class methods" do
54
+ describe "#included_meths" do
55
+ it "lists methods mixed into the class scope as class methods" do
56
56
  b = ModuleObject.new(nil, :Mod2)
57
57
  bmeth = MethodObject.new(b, :foo)
58
58
  bmeth2 = MethodObject.new(b, :foo2)
59
59
  c = NamespaceObject.new(nil, :YARD)
60
60
  c.class_mixins << b
61
61
 
62
- [bmeth, bmeth2].each {|o| o.scope.should == :instance }
62
+ [bmeth, bmeth2].each { |o| expect(o.scope).to eq :instance }
63
63
  meths = c.included_meths(:scope => :class)
64
- meths.each {|o| o.scope.should == :class }
64
+ meths.each { |o| expect(o.scope).to eq :class }
65
65
  end
66
66
 
67
- it "should not list methods overridden by another included module" do
67
+ it "does not list methods overridden by another included module" do
68
68
  a = ModuleObject.new(nil, :Mod)
69
69
  ameth = MethodObject.new(a, :testing)
70
70
  b = ModuleObject.new(nil, :Mod2)
@@ -76,38 +76,38 @@ describe YARD::CodeObjects::NamespaceObject do
76
76
  c.class_mixins.unshift a
77
77
 
78
78
  meths = c.included_meths(:scope => :instance)
79
- meths.should_not include(ameth)
80
- meths.should include(bmeth)
79
+ expect(meths).not_to include(ameth)
80
+ expect(meths).to include(bmeth)
81
81
 
82
82
  meths = c.included_meths(:scope => :class)
83
- meths.should include(ameth)
84
- meths.should_not include(bmeth)
83
+ expect(meths).to include(ameth)
84
+ expect(meths).not_to include(bmeth)
85
85
  end
86
86
  end
87
87
 
88
- describe '#class_attributes' do
89
- it "should list class attributes" do
88
+ describe "#class_attributes" do
89
+ it "lists class attributes" do
90
90
  a = NamespaceObject.new(nil, :Mod)
91
91
  a.attributes[:instance][:a] = { :read => MethodObject.new(a, :a), :write => nil }
92
92
  a.attributes[:instance][:b] = { :read => MethodObject.new(a, :b), :write => nil }
93
93
  a.attributes[:class][:a] = { :read => MethodObject.new(a, :a, :class), :write => nil }
94
- a.class_attributes.keys.should include(:a)
95
- a.class_attributes.keys.should_not include(:b)
94
+ expect(a.class_attributes.keys).to include(:a)
95
+ expect(a.class_attributes.keys).not_to include(:b)
96
96
  end
97
97
  end
98
98
 
99
- describe '#instance_attributes' do
100
- it "should list instance attributes" do
99
+ describe "#instance_attributes" do
100
+ it "lists instance attributes" do
101
101
  a = NamespaceObject.new(nil, :Mod)
102
102
  a.attributes[:instance][:a] = { :read => MethodObject.new(a, :a), :write => nil }
103
103
  a.attributes[:instance][:b] = { :read => MethodObject.new(a, :b), :write => nil }
104
104
  a.attributes[:class][:a] = { :read => MethodObject.new(a, :a, :class), :write => nil }
105
- a.instance_attributes.keys.should include(:a)
106
- a.instance_attributes.keys.should include(:b)
105
+ expect(a.instance_attributes.keys).to include(:a)
106
+ expect(a.instance_attributes.keys).to include(:b)
107
107
  end
108
108
  end
109
109
 
110
- describe '#constants/#included_constants' do
110
+ describe "#constants/#included_constants" do
111
111
  before do
112
112
  Registry.clear
113
113
 
@@ -132,39 +132,39 @@ describe YARD::CodeObjects::NamespaceObject do
132
132
  eof
133
133
  end
134
134
 
135
- it "should list all included constants by default" do
135
+ it "lists all included constants by default" do
136
136
  consts = P(:C).constants
137
- consts.should include(P('A::CONST1'))
138
- consts.should include(P('C::CONST4'))
137
+ expect(consts).to include(P('A::CONST1'))
138
+ expect(consts).to include(P('C::CONST4'))
139
139
  end
140
140
 
141
- it "should allow :included to be set to false to ignore included constants" do
141
+ it "allows :included to be set to false to ignore included constants" do
142
142
  consts = P(:C).constants(:included => false)
143
- consts.should_not include(P('A::CONST1'))
144
- consts.should include(P('C::CONST4'))
143
+ expect(consts).not_to include(P('A::CONST1'))
144
+ expect(consts).to include(P('C::CONST4'))
145
145
  end
146
146
 
147
- it "should not list an included constant if it is defined in the object" do
147
+ it "does not list an included constant if it is defined in the object" do
148
148
  consts = P(:C).constants
149
- consts.should include(P('C::CONST3'))
150
- consts.should_not include(P('B::CONST3'))
149
+ expect(consts).to include(P('C::CONST3'))
150
+ expect(consts).not_to include(P('B::CONST3'))
151
151
  end
152
152
 
153
- it "should not list an included constant if it is shadowed by another included constant" do
153
+ it "does not list an included constant if it is shadowed by another included constant" do
154
154
  consts = P(:C).included_constants
155
- consts.should include(P('B::CONST2'))
156
- consts.should_not include(P('A::CONST2'))
155
+ expect(consts).to include(P('B::CONST2'))
156
+ expect(consts).not_to include(P('A::CONST2'))
157
157
  end
158
158
  end
159
159
 
160
- describe '#included_meths' do
161
- it "should return all included methods with :all = true" do
160
+ describe "#included_meths" do
161
+ it "returns all included methods with :all = true" do
162
162
  YARD.parse_string <<-eof
163
163
  module B; def foo; end end
164
164
  module C; def bar; end end
165
165
  class A; include B; include C; def foo; end; def bar; end end
166
166
  eof
167
- Registry.at('A').included_meths(:all => true).should == [P('C#bar'), P('B#foo')]
167
+ expect(Registry.at('A').included_meths(:all => true)).to eq [P('C#bar'), P('B#foo')]
168
168
  end
169
169
  end
170
170
  end
@@ -3,87 +3,87 @@ require File.dirname(__FILE__) + '/spec_helper'
3
3
  describe YARD::CodeObjects::Proxy do
4
4
  before { Registry.clear }
5
5
 
6
- it "should return the object if it's in the Registry" do
6
+ it "returns the object if it's in the Registry" do
7
7
  pathobj = ModuleObject.new(:root, :YARD)
8
8
  proxyobj = P(:root, :YARD)
9
- proxyobj.type.should == :module
10
- Proxy.should_not === proxyobj
9
+ expect(proxyobj.type).to eq :module
10
+ expect(Proxy === proxyobj).to be false
11
11
  end
12
12
 
13
- it "should handle complex string namespaces" do
13
+ it "handles complex string namespaces" do
14
14
  ModuleObject.new(:root, :A)
15
15
  pathobj = ModuleObject.new(P(nil, :A), :B)
16
- P(:root, "A::B").should be_instance_of(ModuleObject)
16
+ expect(P(:root, "A::B")).to be_instance_of(ModuleObject)
17
17
  end
18
18
 
19
- it "should not return true to Proxy === obj if obj is a Proxy class holding a resolved object" do
20
- Proxy.should === P(:root, 'a')
21
- Proxy.should_not === P(:root)
19
+ it "does not return true to Proxy === obj if obj is a Proxy class holding a resolved object" do
20
+ expect(Proxy === P(:root, 'a')).to be true
21
+ expect(Proxy === P(:root)).to be false
22
22
  MethodObject.new(:root, 'a')
23
- Proxy.should_not === P(:root, 'a')
23
+ expect(Proxy === P(:root, 'a')).to be false
24
24
  x = Proxy.new(:root, 'a')
25
- Proxy.should_not === x
25
+ expect(Proxy === x).to be false
26
26
  end
27
27
 
28
- it "should return the object if it's an included Module" do
28
+ it "returns the object if it's an included Module" do
29
29
  yardobj = ModuleObject.new(:root, :YARD)
30
30
  pathobj = ClassObject.new(:root, :TestClass)
31
31
  pathobj.instance_mixins << yardobj
32
- P(P(nil, :TestClass), :YARD).should be_instance_of(ModuleObject)
32
+ expect(P(P(nil, :TestClass), :YARD)).to be_instance_of(ModuleObject)
33
33
  end
34
34
 
35
- it "should respond_to respond_to?" do
35
+ it "responds to respond_to?" do
36
36
  obj = ClassObject.new(:root, :Object)
37
37
  yardobj = ModuleObject.new(:root, :YARD)
38
- P(:YARD).respond_to?(:children).should == true
39
- P(:NOTYARD).respond_to?(:children).should == false
38
+ expect(P(:YARD).respond_to?(:children)).to be true
39
+ expect(P(:NOTYARD).respond_to?(:children)).to be false
40
40
 
41
- P(:YARD).respond_to?(:initialize).should == false
42
- P(:YARD).respond_to?(:initialize, true).should == true
43
- P(:NOTYARD).respond_to?(:initialize).should == false
44
- P(:NOTYARD).respond_to?(:initialize, true).should == true
41
+ expect(P(:YARD).respond_to?(:initialize)).to be false
42
+ expect(P(:YARD).respond_to?(:initialize, true)).to be true
43
+ expect(P(:NOTYARD).respond_to?(:initialize)).to be false
44
+ expect(P(:NOTYARD).respond_to?(:initialize, true)).to be true
45
45
  end
46
46
 
47
- it "should make itself obvious that it's a proxy" do
47
+ it "makes itself obvious that it's a proxy" do
48
48
  pathobj = P(:root, :YARD)
49
- pathobj.class.should == Proxy
50
- (Proxy === pathobj).should == true
49
+ expect(pathobj.class).to eq Proxy
50
+ expect(Proxy === pathobj).to be true
51
51
  end
52
52
 
53
- it "should pretend it's the object's type if it can resolve" do
53
+ it "pretends it's the object's type if it can resolve" do
54
54
  pathobj = ModuleObject.new(:root, :YARD)
55
55
  proxyobj = P(:root, :YARD)
56
- proxyobj.should be_instance_of(ModuleObject)
56
+ expect(proxyobj).to be_instance_of(ModuleObject)
57
57
  end
58
58
 
59
- it "should handle instance method names" do
59
+ it "handles instance method names" do
60
60
  obj = P(nil, '#test')
61
- obj.name.should == :test
62
- obj.path.should == "#test"
63
- obj.namespace.should == Registry.root
61
+ expect(obj.name).to eq :test
62
+ expect(obj.path).to eq "#test"
63
+ expect(obj.namespace).to eq Registry.root
64
64
  end
65
65
 
66
- it "should handle instance method names under a namespace" do
66
+ it "handles instance method names under a namespace" do
67
67
  pathobj = ModuleObject.new(:root, :YARD)
68
68
  obj = P(pathobj, "A::B#test")
69
- obj.name.should == :test
70
- obj.path.should == "A::B#test"
69
+ expect(obj.name).to eq :test
70
+ expect(obj.path).to eq "A::B#test"
71
71
  end
72
72
 
73
- it "should allow type to be changed" do
73
+ it "allows type to be changed" do
74
74
  obj = P("InvalidClass")
75
- obj.type.should == :proxy
76
- Proxy.should === obj
75
+ expect(obj.type).to eq :proxy
76
+ expect(Proxy === obj).to be true
77
77
  obj.type = :class
78
- obj.type.should == :class
78
+ expect(obj.type).to eq :class
79
79
  end
80
80
 
81
- it "should NOT retain a type change between Proxy objects" do
81
+ it "does NOT retain a type change between Proxy objects" do
82
82
  P("InvalidClass").type = :class
83
- P("InvalidClass").type.should == :proxy
83
+ expect(P("InvalidClass").type).to eq :proxy
84
84
  end
85
85
 
86
- it "should use type to ensure resolved object is of intended type" do
86
+ it "uses type to ensure resolved object is of intended type" do
87
87
  YARD.parse_string <<-eof
88
88
  module Foo
89
89
  class Bar; end
@@ -92,49 +92,49 @@ describe YARD::CodeObjects::Proxy do
92
92
  eof
93
93
  proxy = Proxy.new(P('Foo'), 'Bar')
94
94
  proxy.type = :method
95
- proxy.path.should == 'Foo.Bar'
95
+ expect(proxy.path).to eq 'Foo.Bar'
96
96
  end
97
97
 
98
- it "should allow type in initializer" do
99
- Proxy.new(Registry.root, 'Foo', :method).type.should == :method
100
- P(Registry.root, 'Foo', :method).type.should == :method
98
+ it "allows type in initializer" do
99
+ expect(Proxy.new(Registry.root, 'Foo', :method).type).to eq :method
100
+ expect(P(Registry.root, 'Foo', :method).type).to eq :method
101
101
  end
102
102
 
103
- it "should never equal Registry.root" do
104
- P("MYPROXY").should_not == Registry.root
105
- P("X::A").should_not == Registry.root
103
+ it "never equals Registry.root" do
104
+ expect(P("MYPROXY")).not_to eq Registry.root
105
+ expect(P("X::A")).not_to eq Registry.root
106
106
  end
107
107
 
108
- it "should reset namespace and name when object is resolved" do
108
+ it "resets namespace and name when object is resolved" do
109
109
  obj1 = ModuleObject.new(:root, :YARD)
110
110
  obj2 = ModuleObject.new(:root, :NOTYARD)
111
111
  resolved = Proxy.new(obj2, :YARD)
112
- resolved.should == obj1
113
- resolved.namespace.should == Registry.root
114
- resolved.name.should == :YARD
112
+ expect(resolved).to eq obj1
113
+ expect(resolved.namespace).to eq Registry.root
114
+ expect(resolved.name).to eq :YARD
115
115
  end
116
116
 
117
- it "should ensure that the correct object was resolved" do
117
+ it "ensures that the correct object was resolved" do
118
118
  foo = ModuleObject.new(:root, :Foo)
119
119
  foobar = ModuleObject.new(foo, :Bar)
120
120
  foobaz = ClassObject.new(foo, :Baz)
121
121
 
122
122
  # Remember, we're looking for Qux::Bar, not just 'Bar'
123
123
  proxy = Proxy.new(foobar, 'Foo::Qux::Bar')
124
- proxy.type.should == :proxy
124
+ expect(proxy.type).to eq :proxy
125
125
 
126
126
  qux = ModuleObject.new(foo, :Qux)
127
127
  quxbar = ModuleObject.new(qux, :Bar)
128
128
 
129
129
  # Now it should resolve
130
- proxy.type.should == :module
130
+ expect(proxy.type).to eq :module
131
131
  end
132
132
 
133
- it "should handle constant names in namespaces" do
133
+ it "handles constant names in namespaces" do
134
134
  YARD.parse_string <<-eof
135
135
  module A; end; B = A
136
136
  module B::C; def foo; end end
137
137
  eof
138
- Proxy.new(:root, 'B::C').should == Registry.at('A::C')
138
+ expect(Proxy.new(:root, 'B::C')).to eq Registry.at('A::C')
139
139
  end
140
140
  end