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,12 +3,12 @@ require File.dirname(__FILE__) + '/spec_helper'
3
3
  describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}MethodConditionHandler" do
4
4
  before(:all) { parse_file :method_condition_handler_001, __FILE__ }
5
5
 
6
- it "should not parse regular if blocks in methods" do
7
- Registry.at('#b').should be_nil
6
+ it "does not parse regular if blocks in methods" do
7
+ expect(Registry.at('#b')).to be nil
8
8
  end
9
9
 
10
- it "should parse if/unless blocks in the form X if COND" do
11
- Registry.at('#c').should_not be_nil
12
- Registry.at('#d').should_not be_nil
10
+ it "parses if/unless blocks in the form X if COND" do
11
+ expect(Registry.at('#c')).not_to be nil
12
+ expect(Registry.at('#d')).not_to be nil
13
13
  end
14
14
  end
@@ -7,178 +7,178 @@ describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}MethodHandler"
7
7
  end
8
8
  end
9
9
 
10
- it "should add methods to parent's #meths list" do
11
- P(:Foo).meths.should include(P("Foo#method1"))
10
+ it "adds methods to parent's #meths list" do
11
+ expect(P(:Foo).meths).to include(P("Foo#method1"))
12
12
  end
13
13
 
14
- it "should parse/add class methods (self.method2)" do
15
- P(:Foo).meths.should include(P("Foo.method2"))
14
+ it "parses and adds class methods (self.method2)" do
15
+ expect(P(:Foo).meths).to include(P("Foo.method2"))
16
16
  end
17
17
 
18
- it "should parse/add class methods from other namespaces (String.hello)" do
19
- P("String.hello").should be_instance_of(CodeObjects::MethodObject)
18
+ it "parses and adds class methods from other namespaces (String.hello)" do
19
+ expect(P("String.hello")).to be_instance_of(CodeObjects::MethodObject)
20
20
  end
21
21
 
22
22
  [:[], :[]=, :allowed?, :/, :=~, :==, :`, :|, :*, :&, :%, :'^', :-@, :+@, :'~@'].each do |name|
23
- it "should allow valid method #{name}" do
24
- Registry.at("Foo##{name}").should_not be_nil
23
+ it "allows valid method #{name}" do
24
+ expect(Registry.at("Foo##{name}")).not_to be nil
25
25
  end
26
26
  end
27
27
 
28
- it "should allow self.methname" do
29
- Registry.at("Foo.new").should_not be_nil
28
+ it "allows self.methname" do
29
+ expect(Registry.at("Foo.new")).not_to be nil
30
30
  end
31
31
 
32
- it "should mark dynamic methods as such" do
33
- P('Foo#dynamic').dynamic?.should == true
32
+ it "marks dynamic methods as such" do
33
+ expect(P('Foo#dynamic').dynamic?).to be true
34
34
  end
35
35
 
36
- it "should show that a method is explicitly defined (if it was originally defined implicitly by attribute)" do
37
- P('Foo#method1').is_explicit?.should == true
36
+ it "shows that a method is explicitly defined (if it was originally defined implicitly by attribute)" do
37
+ expect(P('Foo#method1').is_explicit?).to be true
38
38
  end
39
39
 
40
- it "should handle parameters" do
41
- P('Foo#[]').parameters.should == [['key', "'default'"]]
42
- P('Foo#/').parameters.should == [['x', "File.new('x', 'w')"], ['y', '2']]
40
+ it "handles parameters" do
41
+ expect(P('Foo#[]').parameters).to eq [['key', "'default'"]]
42
+ expect(P('Foo#/').parameters).to eq [['x', "File.new('x', 'w')"], ['y', '2']]
43
43
  end
44
44
 
45
- it "should handle opts = {} as parameter" do
46
- P('Foo#optsmeth').parameters.should == [['x', nil], ['opts', '{}']]
45
+ it "handles opts = {} as parameter" do
46
+ expect(P('Foo#optsmeth').parameters).to eq [['x', nil], ['opts', '{}']]
47
47
  end
48
48
 
49
- it "should handle &block as parameter" do
50
- P('Foo#blockmeth').parameters.should == [['x', nil], ['&block', nil]]
49
+ it "handles &block as parameter" do
50
+ expect(P('Foo#blockmeth').parameters).to eq [['x', nil], ['&block', nil]]
51
51
  end
52
52
 
53
- it "should handle overloads" do
53
+ it "handles overloads" do
54
54
  meth = P('Foo#foo')
55
55
 
56
56
  o1 = meth.tags(:overload).first
57
- o1.name.should == :bar
58
- o1.parameters.should == [['a', nil], ['b', "1"]]
59
- o1.tag(:return).type.should == "String"
57
+ expect(o1.name).to eq :bar
58
+ expect(o1.parameters).to eq [['a', nil], ['b', "1"]]
59
+ expect(o1.tag(:return).type).to eq "String"
60
60
 
61
61
  o2 = meth.tags(:overload)[1]
62
- o2.name.should == :baz
63
- o2.parameters.should == [['b', nil], ['c', nil]]
64
- o2.tag(:return).type.should == "Fixnum"
62
+ expect(o2.name).to eq :baz
63
+ expect(o2.parameters).to eq [['b', nil], ['c', nil]]
64
+ expect(o2.tag(:return).type).to eq "Fixnum"
65
65
 
66
66
  o3 = meth.tags(:overload)[2]
67
- o3.name.should == :bang
68
- o3.parameters.should == [['d', nil], ['e', nil]]
69
- o3.docstring.should be_empty
70
- o3.docstring.should be_blank
67
+ expect(o3.name).to eq :bang
68
+ expect(o3.parameters).to eq [['d', nil], ['e', nil]]
69
+ expect(o3.docstring).to be_empty
70
+ expect(o3.docstring).to be_blank
71
71
  end
72
72
 
73
- it "should set a return tag if not set on #initialize" do
73
+ it "sets a return tag if not set on #initialize" do
74
74
  meth = P('Foo#initialize')
75
75
 
76
- meth.should have_tag(:return)
77
- meth.tag(:return).types.should == ["Foo"]
78
- meth.tag(:return).text.should == "a new instance of Foo"
76
+ expect(meth).to have_tag(:return)
77
+ expect(meth.tag(:return).types).to eq ["Foo"]
78
+ expect(meth.tag(:return).text).to eq "a new instance of Foo"
79
79
  end
80
80
 
81
81
  %w(inherited included method_added method_removed method_undefined).each do |meth|
82
- it "should set @private tag on #{meth} callback method if no docstring is set" do
83
- P('Foo.' + meth).should have_tag(:private)
82
+ it "sets @private tag on #{meth} callback method if no docstring is set" do
83
+ expect(P('Foo.' + meth)).to have_tag(:private)
84
84
  end
85
85
  end
86
86
 
87
- it "should not set @private tag on extended callback method since docstring is set" do
88
- P('Foo.extended').should_not have_tag(:private)
87
+ it "does not set @private tag on extended callback method since docstring is set" do
88
+ expect(P('Foo.extended')).not_to have_tag(:private)
89
89
  end
90
90
 
91
- it "should add @return [Boolean] tag to methods ending in ? without return types" do
91
+ it "adds @return [Boolean] tag to methods ending in ? without return types" do
92
92
  meth = P('Foo#boolean?')
93
- meth.should have_tag(:return)
94
- meth.tag(:return).types.should == ['Boolean']
93
+ expect(meth).to have_tag(:return)
94
+ expect(meth.tag(:return).types).to eq ['Boolean']
95
95
  end
96
96
 
97
- it "should add Boolean type to return tag without types" do
97
+ it "adds Boolean type to return tag without types" do
98
98
  meth = P('Foo#boolean2?')
99
- meth.should have_tag(:return)
100
- meth.tag(:return).types.should == ['Boolean']
99
+ expect(meth).to have_tag(:return)
100
+ expect(meth.tag(:return).types).to eq ['Boolean']
101
101
  end
102
102
 
103
- it "should not change return type for method ending in ? with return types set" do
103
+ it "does not change return type for method ending in ? with return types set" do
104
104
  meth = P('Foo#boolean3?')
105
- meth.should have_tag(:return)
106
- meth.tag(:return).types.should == ['NotBoolean', 'nil']
105
+ expect(meth).to have_tag(:return)
106
+ expect(meth.tag(:return).types).to eq ['NotBoolean', 'nil']
107
107
  end
108
108
 
109
- it "should not change return type for method ending in ? with return types set by @overload" do
109
+ it "does not change return type for method ending in ? with return types set by @overload" do
110
110
  meth = P('Foo#rainy?')
111
- meth.should have_tag(:overload)
112
- meth.tag(:overload).should have_tag(:return)
113
- meth.should_not have_tag(:return)
111
+ expect(meth).to have_tag(:overload)
112
+ expect(meth.tag(:overload)).to have_tag(:return)
113
+ expect(meth).not_to have_tag(:return)
114
114
  end
115
115
 
116
- it "should add method writer to existing attribute" do
117
- Registry.at('Foo#attr_name').should be_reader
118
- Registry.at('Foo#attr_name=').should be_writer
116
+ it "adds method writer to existing attribute" do
117
+ expect(Registry.at('Foo#attr_name')).to be_reader
118
+ expect(Registry.at('Foo#attr_name=')).to be_writer
119
119
  end
120
120
 
121
- it "should add method reader to existing attribute" do
122
- Registry.at('Foo#attr_name2').should be_reader
123
- Registry.at('Foo#attr_name2=').should be_writer
121
+ it "adds method reader to existing attribute" do
122
+ expect(Registry.at('Foo#attr_name2')).to be_reader
123
+ expect(Registry.at('Foo#attr_name2=')).to be_writer
124
124
  end
125
125
 
126
- it "should generate an options parameter if @option refers to an undocumented parameter" do
126
+ it "generates an options parameter if @option refers to an undocumented parameter" do
127
127
  meth = P('Foo#auto_opts')
128
- meth.should have_tag(:param)
129
- meth.tag(:param).name.should == "opts"
130
- meth.tag(:param).types.should == ["Hash"]
128
+ expect(meth).to have_tag(:param)
129
+ expect(meth.tag(:param).name).to eq "opts"
130
+ expect(meth.tag(:param).types).to eq ["Hash"]
131
131
  end
132
132
 
133
- it "should raise an undocumentable error when a method is defined on an object instance" do
133
+ it "raises an undocumentable error when a method is defined on an object instance" do
134
134
  undoc_error "error = Foo; def error.at(foo) end"
135
- Registry.at('error').should be_nil
135
+ expect(Registry.at('error')).to be nil
136
136
  end
137
137
 
138
- it "should allow class method to be defined on constant reference object" do
139
- Registry.at('Foo.meth_on_const').should_not be_nil
140
- Registry.at('Foo.meth2_on_const').should_not be_nil
138
+ it "allows class method to be defined on constant reference object" do
139
+ expect(Registry.at('Foo.meth_on_const')).not_to be nil
140
+ expect(Registry.at('Foo.meth2_on_const')).not_to be nil
141
141
  end
142
142
 
143
- it "should copy alias information on method (re-)definition to new method" do
144
- Registry.at('D').aliases.should be_empty
145
- Registry.at('D#b').is_alias?.should == false
146
- Registry.at('D#a').is_alias?.should == false
143
+ it "copies alias information on method (re-)definition to new method" do
144
+ expect(Registry.at('D').aliases).to be_empty
145
+ expect(Registry.at('D#b').is_alias?).to be false
146
+ expect(Registry.at('D#a').is_alias?).to be false
147
147
  end
148
148
 
149
- it "should add macros for class methods" do
149
+ it "adds macros for class methods" do
150
150
  macro = CodeObjects::MacroObject.find('prop')
151
- macro.should_not be_nil
152
- macro.macro_data.should == "@!method $1(value)\n$3\n@return [$2]"
153
- macro.method_object.should == Registry.at('E.property')
154
- macro.should be_attached
151
+ expect(macro).not_to be nil
152
+ expect(macro.macro_data).to eq "@!method $1(value)\n$3\n@return [$2]"
153
+ expect(macro.method_object).to eq Registry.at('E.property')
154
+ expect(macro).to be_attached
155
155
  obj = Registry.at('E#foo')
156
- obj.should_not be_nil
157
- obj.docstring.should == 'create a foo'
158
- obj.signature.should == 'def foo(value)'
159
- obj.tag(:return).types.should == ['String']
156
+ expect(obj).not_to be nil
157
+ expect(obj.docstring).to eq 'create a foo'
158
+ expect(obj.signature).to eq 'def foo(value)'
159
+ expect(obj.tag(:return).types).to eq ['String']
160
160
  end
161
161
 
162
- it "should handle macros on any object" do
162
+ it "handles macros on any object" do
163
163
  macro = CodeObjects::MacroObject.find('xyz')
164
- macro.should_not be_nil
165
- macro.macro_data.should == '@!method $1'
164
+ expect(macro).not_to be nil
165
+ expect(macro.macro_data).to eq '@!method $1'
166
166
  end
167
167
 
168
- it "should skip macros on instance methods" do
169
- Registry.at('E#a').should be_nil
168
+ it "skips macros on instance methods" do
169
+ expect(Registry.at('E#a')).to be nil
170
170
  end
171
171
 
172
- it "should warn if the macro name is invalid" do
173
- log.should_receive(:warn).with(/Invalid directive.*@!macro/)
172
+ it "warns if the macro name is invalid" do
173
+ expect(log).to receive(:warn).with(/Invalid directive.*@!macro/)
174
174
  YARD.parse_string "class Foo\n# @!macro\ndef self.foo; end\nend"
175
175
  end
176
176
 
177
- it "should handle 'def end' methods" do
177
+ it "handles 'def end' methods" do
178
178
  obj = Registry.at('F::A#foo')
179
- obj.should_not be_nil
179
+ expect(obj).not_to be nil
180
180
  obj = Registry.at('F::A#bar')
181
- obj.should_not be_nil
182
- obj.docstring.should == 'PASS'
181
+ expect(obj).not_to be nil
182
+ expect(obj.docstring).to eq 'PASS'
183
183
  end
184
184
  end
@@ -3,53 +3,53 @@ require File.dirname(__FILE__) + '/spec_helper'
3
3
  describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}MixinHandler" do
4
4
  before(:all) { parse_file :mixin_handler_001, __FILE__ }
5
5
 
6
- it "should handle includes from classes or modules" do
7
- Registry.at(:X).instance_mixins.should include(P(:A))
8
- Registry.at(:Y).instance_mixins.should include(P(:A))
6
+ it "handles includes from classes or modules" do
7
+ expect(Registry.at(:X).instance_mixins).to include(P(:A))
8
+ expect(Registry.at(:Y).instance_mixins).to include(P(:A))
9
9
  end
10
10
 
11
- it "should handle includes in class << self" do
12
- Registry.at(:Y).class_mixins.should include(P(:A))
11
+ it "handles includes in class << self" do
12
+ expect(Registry.at(:Y).class_mixins).to include(P(:A))
13
13
  end
14
14
 
15
- it "should handle includes for modules that don't yet exist" do
16
- Registry.at(:X).instance_mixins.should include(P(nil, :NOTEXIST))
15
+ it "handles includes for modules that don't yet exist" do
16
+ expect(Registry.at(:X).instance_mixins).to include(P(nil, :NOTEXIST))
17
17
  end
18
18
 
19
- it "should set the type of non-existing modules to :module" do
19
+ it "sets the type of non-existing modules to :module" do
20
20
  o = Registry.at(:X).instance_mixins.find {|o| o.name == :NOTEXIST }
21
- o.type.should == :module
21
+ expect(o.type).to eq :module
22
22
  end
23
23
 
24
- it "should handle includes with multiple parameters" do
25
- Registry.at(:X).should_not be_nil
24
+ it "handles includes with multiple parameters" do
25
+ expect(Registry.at(:X)).not_to be nil
26
26
  end
27
27
 
28
- it "should handle complex include statements" do
29
- P(:Y).instance_mixins.should include(P('B::C'))
30
- P(:Y).instance_mixins.should include(P(:B))
28
+ it "handles complex include statements" do
29
+ expect(P(:Y).instance_mixins).to include(P('B::C'))
30
+ expect(P(:Y).instance_mixins).to include(P(:B))
31
31
  end
32
32
 
33
- it "should treat a mixed in Constant by taking its value as the real object name" do
34
- P(:Y).instance_mixins.should include(Registry.at('B::D'))
33
+ it "treats a mixed in Constant by taking its value as the real object name" do
34
+ expect(P(:Y).instance_mixins).to include(Registry.at('B::D'))
35
35
  end
36
36
 
37
- it "should add includes in the correct order when include is given multiple arguments" do
38
- P(:Z).instance_mixins.should == [P(:A), P(:B)]
37
+ it "adds includes in the correct order when include is given multiple arguments" do
38
+ expect(P(:Z).instance_mixins).to eq [P(:A), P(:B)]
39
39
  end
40
40
 
41
- it "should avoid including self for unresolved mixins of the same name" do
42
- P("ABC::DEF::FOO").mixins.should == [P("ABC::FOO")]
43
- P("ABC::DEF::BAR").mixins.should == [P("ABC::BAR")]
41
+ it "avoids including self for unresolved mixins of the same name" do
42
+ expect(P("ABC::DEF::FOO").mixins).to eq [P("ABC::FOO")]
43
+ expect(P("ABC::DEF::BAR").mixins).to eq [P("ABC::BAR")]
44
44
  end
45
45
 
46
- it "should raise undocumentable error if argument is variable" do
46
+ it "raises undocumentable error if argument is variable" do
47
47
  undoc_error "module X; include invalid; end"
48
- Registry.at('X').mixins.should == []
48
+ expect(Registry.at('X').mixins).to eq []
49
49
  end
50
50
 
51
- it "should parse all other arguments before erroring out on undocumentable error" do
51
+ it "parses all other arguments before erroring out on undocumentable error" do
52
52
  undoc_error "module X; include invalid, Y; end"
53
- Registry.at('X').mixins.should == [P('Y')]
53
+ expect(Registry.at('X').mixins).to eq [P('Y')]
54
54
  end
55
55
  end
@@ -6,15 +6,15 @@ describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}VisibilityHand
6
6
  def assert_module_function(namespace, name)
7
7
  klass = Registry.at("#{namespace}.#{name}")
8
8
  instance = Registry.at("#{namespace}##{name}")
9
- klass.should_not be_nil
10
- instance.should_not be_nil
11
- klass.should be_module_function
12
- instance.should_not be_module_function
13
- klass.visibility.should == :public
14
- instance.visibility.should == :private
9
+ expect(klass).not_to be nil
10
+ expect(instance).not_to be nil
11
+ expect(klass).to be_module_function
12
+ expect(instance).not_to be_module_function
13
+ expect(klass.visibility).to eq :public
14
+ expect(instance.visibility).to eq :private
15
15
  end
16
16
 
17
- it "should be able to create a module function with parameters" do
17
+ it "is able to create a module function with parameters" do
18
18
  YARD.parse_string <<-eof
19
19
  module Foo
20
20
  def bar; end
@@ -27,7 +27,7 @@ describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}VisibilityHand
27
27
  assert_module_function('Foo', 'baz')
28
28
  end
29
29
 
30
- it "should be able to set scope for duration of block without params" do
30
+ it "is able to set scope for duration of block without params" do
31
31
  YARD.parse_string <<-eof
32
32
  module Foo
33
33
  def qux; end
@@ -38,13 +38,13 @@ describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}VisibilityHand
38
38
  def baz; end
39
39
  end
40
40
  eof
41
- Registry.at('Foo.qux').should be_nil
41
+ expect(Registry.at('Foo.qux')).to be nil
42
42
  assert_module_function('Foo', 'bar')
43
43
  assert_module_function('Foo', 'baz')
44
44
  end
45
45
 
46
46
  # @bug gh-563
47
- it "should copy tags to module function properly" do
47
+ it "copies tags to module function properly" do
48
48
  YARD.parse_string <<-eof
49
49
  module Foo
50
50
  # @param [String] foo bar
@@ -56,17 +56,17 @@ describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}VisibilityHand
56
56
  eof
57
57
  assert_module_function('Foo', 'bar')
58
58
  o = Registry.at('Foo.bar')
59
- o.tag(:param).types.should == ['String']
60
- o.tag(:param).name.should == 'foo'
61
- o.tag(:param).text.should == 'bar'
62
- o.tag(:option).name.should == 'foo'
63
- o.tag(:option).pair.types.should == ['String']
64
- o.tag(:option).pair.defaults.should == ['nil']
65
- o.tag(:option).pair.text.should == 'baz'
66
- o.tag(:return).types.should == ['void']
59
+ expect(o.tag(:param).types).to eq ['String']
60
+ expect(o.tag(:param).name).to eq 'foo'
61
+ expect(o.tag(:param).text).to eq 'bar'
62
+ expect(o.tag(:option).name).to eq 'foo'
63
+ expect(o.tag(:option).pair.types).to eq ['String']
64
+ expect(o.tag(:option).pair.defaults).to eq ['nil']
65
+ expect(o.tag(:option).pair.text).to eq 'baz'
66
+ expect(o.tag(:return).types).to eq ['void']
67
67
  end
68
68
 
69
- it "should handle all method names in parameters" do
69
+ it "handles all method names in parameters" do
70
70
  YARD.parse_string <<-eof
71
71
  module Foo
72
72
  def -(t); end
@@ -80,7 +80,7 @@ describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}VisibilityHand
80
80
  assert_module_function('Foo', 'a?')
81
81
  end
82
82
 
83
- it "should only accept strings and symbols" do
83
+ it "only accepts strings and symbols" do
84
84
  YARD.parse_string <<-eof
85
85
  module Foo
86
86
  module_function name
@@ -88,12 +88,12 @@ describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}VisibilityHand
88
88
  module_function *(method_call)
89
89
  end
90
90
  eof
91
- Registry.at('Foo#name').should be_nil
92
- Registry.at('Foo#argument').should be_nil
93
- Registry.at('Foo#method_call').should be_nil
91
+ expect(Registry.at('Foo#name')).to be nil
92
+ expect(Registry.at('Foo#argument')).to be nil
93
+ expect(Registry.at('Foo#method_call')).to be nil
94
94
  end
95
95
 
96
- it "should handle constants passed in as symbols" do
96
+ it "handles constants passed in as symbols" do
97
97
  YARD.parse_string <<-eof
98
98
  module Foo
99
99
  def Foo; end