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
@@ -5,30 +5,30 @@ describe YARD::Tags::Library do
5
5
  Docstring.new(docstring).tags.first
6
6
  end
7
7
 
8
- describe '#see_tag' do
9
- it "should take a URL" do
10
- tag("@see http://example.com").name.should == "http://example.com"
8
+ describe "#see_tag" do
9
+ it "takes a URL" do
10
+ expect(tag("@see http://example.com").name).to eq "http://example.com"
11
11
  end
12
12
 
13
- it "should take an object path" do
14
- tag("@see String#reverse").name.should == "String#reverse"
13
+ it "takes an object path" do
14
+ expect(tag("@see String#reverse").name).to eq "String#reverse"
15
15
  end
16
16
 
17
- it "should take a description after the url/object" do
17
+ it "takes a description after the url/object" do
18
18
  tag = tag("@see http://example.com An Example Site")
19
- tag.name.should == "http://example.com"
20
- tag.text.should == "An Example Site"
19
+ expect(tag.name).to eq "http://example.com"
20
+ expect(tag.text).to eq "An Example Site"
21
21
  end
22
22
  end
23
23
 
24
- describe '.define_tag' do
25
- it "should allow defining tags with '.' in the name (x.y.z defines method x_y_z)" do
24
+ describe ".define_tag" do
25
+ it "allows defining tags with '.' in the name (x.y.z defines method x_y_z)" do
26
26
  Tags::Library.define_tag("foo", 'x.y.z')
27
27
  Tags::Library.define_tag("foo2", 'x.y.zz', Tags::OverloadTag)
28
- Tags::Library.instance.method(:x_y_z_tag).should_not be_nil
29
- Tags::Library.instance.method(:x_y_zz_tag).should_not be_nil
30
- tag('@x.y.z foo bar').text.should == 'foo bar'
31
- tag('@x.y.zz foo(bar)').signature.should == 'foo(bar)'
28
+ expect(Tags::Library.instance.method(:x_y_z_tag)).not_to be nil
29
+ expect(Tags::Library.instance.method(:x_y_zz_tag)).not_to be nil
30
+ expect(tag('@x.y.z foo bar').text).to eq 'foo bar'
31
+ expect(tag('@x.y.zz foo(bar)').signature).to eq 'foo(bar)'
32
32
  end
33
33
  end
34
34
  end
@@ -10,44 +10,44 @@ describe YARD::Tags::OverloadTag do
10
10
  eof
11
11
  end
12
12
 
13
- it "should parse the first line as a method signature" do
14
- @tag.signature.should == "def bar(a, b = 1, &block)"
15
- @tag.parameters.should == [['a', nil], ['b', "1"], ['&block', nil]]
13
+ it "parses the first line as a method signature" do
14
+ expect(@tag.signature).to eq "def bar(a, b = 1, &block)"
15
+ expect(@tag.parameters).to eq [['a', nil], ['b', "1"], ['&block', nil]]
16
16
  end
17
17
 
18
- it "should parse the rest of the text as a new Docstring" do
19
- @tag.docstring.should be_instance_of(Docstring)
20
- @tag.docstring.should == "Hello world"
18
+ it "parses the rest of the text as a new Docstring" do
19
+ expect(@tag.docstring).to be_instance_of(Docstring)
20
+ expect(@tag.docstring).to eq "Hello world"
21
21
  end
22
22
 
23
- it "should set Docstring's object after #object= is called" do
24
- m = mock(:object)
23
+ it "sets Docstring's object after #object= is called" do
24
+ m = double(:object)
25
25
  @tag.object = m
26
- @tag.docstring.object.should == m
26
+ expect(@tag.docstring.object).to eq m
27
27
  end
28
28
 
29
- it "should respond to #tag, #tags and #has_tag?" do
30
- @tag.object = mock(:object)
31
- @tag.tags.size.should == 2
32
- @tag.tag(:param).name.should == "a"
33
- @tag.has_tag?(:return).should == true
29
+ it "responds to #tag, #tags and #has_tag?" do
30
+ @tag.object = double(:object)
31
+ expect(@tag.tags.size).to eq 2
32
+ expect(@tag.tag(:param).name).to eq "a"
33
+ expect(@tag.has_tag?(:return)).to be true
34
34
  end
35
35
 
36
- it "should not be a CodeObjects::Base when not hooked up to an object" do
36
+ it "is not a CodeObjects::Base when not hooked up to an object" do
37
37
  @tag.object = nil
38
- @tag.is_a?(CodeObjects::Base).should == false
38
+ expect(@tag.is_a?(CodeObjects::Base)).to be false
39
39
  end
40
40
 
41
- it "should be a CodeObjects::Base when hooked up to an object" do
42
- @tag.object = mock(:object)
43
- @tag.object.should_receive(:is_a?).at_least(3).times.with(CodeObjects::Base).and_return(true)
44
- @tag.is_a?(CodeObjects::Base).should == true
45
- @tag.kind_of?(CodeObjects::Base).should == true
46
- (CodeObjects::Base === @tag).should == true
41
+ it "is a CodeObjects::Base when hooked up to an object" do
42
+ @tag.object = double(:object)
43
+ expect(@tag.object).to receive(:is_a?).at_least(3).times.with(CodeObjects::Base).and_return(true)
44
+ expect(@tag.is_a?(CodeObjects::Base)).to be true
45
+ expect(@tag.kind_of?(CodeObjects::Base)).to be true
46
+ expect(CodeObjects::Base === @tag).to be true
47
47
  end
48
48
 
49
- it "should not parse 'def' out of method name" do
49
+ it "does not parse 'def' out of method name" do
50
50
  tag = Tags::OverloadTag.new(:overload, "default")
51
- tag.signature.should == "default"
51
+ expect(tag.signature).to eq "default"
52
52
  end
53
53
  end
@@ -3,27 +3,27 @@ require File.dirname(__FILE__) + '/../spec_helper'
3
3
  describe YARD::Tags::RefTagList do
4
4
  before { YARD::Registry.clear }
5
5
 
6
- it "should accept symbol or string as owner's path and convert it into a proxy" do
6
+ it "accepts symbol or string as owner's path and convert it into a proxy" do
7
7
  t = Tags::RefTagList.new('author', :String)
8
- t.owner.should == P(:String)
8
+ expect(t.owner).to eq P(:String)
9
9
  end
10
10
 
11
- it "should accept proxy object as owner" do
11
+ it "accepts proxy object as owner" do
12
12
  t = Tags::RefTagList.new('author', P(:String))
13
- t.owner.should == P(:String)
13
+ expect(t.owner).to eq P(:String)
14
14
  end
15
15
 
16
- it "should return tags from a proxy object" do
16
+ it "returns tags from a proxy object" do
17
17
  o = CodeObjects::ClassObject.new(:root, :String)
18
18
  t = Tags::Tag.new(:author, 'foo')
19
19
  o.docstring.add_tag(t)
20
20
 
21
21
  ref = Tags::RefTagList.new('author', :String)
22
- ref.tags.should == [t]
23
- ref.tags.first.text.should == 'foo'
22
+ expect(ref.tags).to eq [t]
23
+ expect(ref.tags.first.text).to eq 'foo'
24
24
  end
25
25
 
26
- it "should return named tags from a proxy object" do
26
+ it "returns named tags from a proxy object" do
27
27
  o = CodeObjects::ClassObject.new(:root, :String)
28
28
  p1 = Tags::Tag.new(:param, 'bar1', nil, 'foo')
29
29
  p2 = Tags::Tag.new(:param, 'bar2', nil, 'foo')
@@ -32,8 +32,8 @@ describe YARD::Tags::RefTagList do
32
32
  o.docstring.add_tag(p1, t1, p2, p3)
33
33
 
34
34
  ref = Tags::RefTagList.new('param', :String, 'foo')
35
- ref.tags.should == [p1, p2]
36
- ref.tags.first.text.should == 'bar1'
35
+ expect(ref.tags).to eq [p1, p2]
36
+ expect(ref.tags.first.text).to eq 'bar1'
37
37
  end
38
38
 
39
39
  it "all tags should respond to #owner and be a RefTag" do
@@ -46,8 +46,8 @@ describe YARD::Tags::RefTagList do
46
46
 
47
47
  ref = Tags::RefTagList.new('param', :String)
48
48
  ref.tags.each do |t|
49
- t.should be_kind_of(Tags::RefTag)
50
- t.owner.should == o
49
+ expect(t).to be_kind_of(Tags::RefTag)
50
+ expect(t.owner).to eq o
51
51
  end
52
52
  end
53
53
  end
@@ -30,15 +30,15 @@ describe YARD::Templates::Engine.template(:default, :docstring) do
30
30
  eof
31
31
  end
32
32
 
33
- it "should render html format correctly" do
33
+ it "renders html format correctly" do
34
34
  html_equals(Registry.at('A').format(html_options), :class001)
35
35
  end
36
36
 
37
- it "should render text format correctly" do
37
+ it "renders text format correctly" do
38
38
  text_equals(Registry.at('A').format, :class001)
39
39
  end
40
40
 
41
- it "should hide private constructors" do
41
+ it "hides private constructors" do
42
42
  html_equals(Registry.at('D').format(html_options(:verifier => Verifier.new("!@private"))), :class002)
43
43
  end
44
44
  end
@@ -1,8 +1,8 @@
1
1
  require File.dirname(__FILE__) + "/spec_helper"
2
2
 
3
3
  describe YARD::Templates::Engine.template(:default, :constant) do
4
- describe 'fully dressed constant' do
5
- it "should render text format correctly" do
4
+ describe "fully dressed constant" do
5
+ it "renders text format correctly" do
6
6
  YARD.parse_string <<-'eof'
7
7
  class YARD::CLI::YRI
8
8
  # Default search paths that should be loaded dynamically into YRI. These paths
@@ -20,8 +20,8 @@ describe YARD::Templates::Engine.template(:default, :constant) do
20
20
  end
21
21
  end
22
22
 
23
- describe 'simple constant with no documentation' do
24
- it "should render text format correctly" do
23
+ describe "simple constant with no documentation" do
24
+ it "renders text format correctly" do
25
25
  # Short constant should show on single line
26
26
  YARD.parse_string <<-'eof'
27
27
  MYCONST = 'foo'
@@ -1,84 +1,84 @@
1
1
  require File.dirname(__FILE__) + '/spec_helper'
2
2
 
3
3
  describe YARD::Templates::Engine do
4
- describe '.register_template_path' do
5
- it "should register a String path" do
4
+ describe ".register_template_path" do
5
+ it "registers a String path" do
6
6
  Engine.register_template_path('.')
7
- Engine.template_paths.pop.should == '.'
7
+ expect(Engine.template_paths.pop).to eq '.'
8
8
  end
9
9
  end
10
10
 
11
- describe '.template!' do
12
- it "should create a module including Template" do
11
+ describe ".template!" do
12
+ it "creates a module including Template" do
13
13
  mod = Engine.template!('path/to/template')
14
- mod.should include(Template)
15
- mod.full_path.to_s.should == 'path/to/template'
14
+ expect(mod).to include(Template)
15
+ expect(mod.full_path.to_s).to eq 'path/to/template'
16
16
  end
17
17
 
18
- it "should create a module including Template with full_path" do
18
+ it "creates a module including Template with full_path" do
19
19
  mod = Engine.template!('path/to/template2', '/full/path/to/template2')
20
- mod.should include(Template)
21
- mod.full_path.to_s.should == '/full/path/to/template2'
20
+ expect(mod).to include(Template)
21
+ expect(mod.full_path.to_s).to eq '/full/path/to/template2'
22
22
  end
23
23
  end
24
24
 
25
- describe '.template' do
26
- it "should raise an error if the template is not found" do
27
- lambda { Engine.template(:a, :b, :c) }.should raise_error(ArgumentError)
25
+ describe ".template" do
26
+ it "raises an error if the template is not found" do
27
+ expect { Engine.template(:a, :b, :c) }.to raise_error(ArgumentError)
28
28
  end
29
29
 
30
- it "should create a module including Template" do
31
- mock = mock(:template)
32
- Engine.should_receive(:find_template_paths).with(nil, 'template/name').and_return(['/full/path/template/name'])
33
- Engine.should_receive(:template!).with('template/name', ['/full/path/template/name']).and_return(mock)
34
- Engine.template('template/name').should == mock
30
+ it "creates a module including Template" do
31
+ mock = double(:template)
32
+ expect(Engine).to receive(:find_template_paths).with(nil, 'template/name').and_return(['/full/path/template/name'])
33
+ expect(Engine).to receive(:template!).with('template/name', ['/full/path/template/name']).and_return(mock)
34
+ expect(Engine.template('template/name')).to eq mock
35
35
  end
36
36
 
37
- it "should create a Template from a relative Template path" do
38
- Engine.should_receive(:template_paths).and_return([])
39
- File.should_receive(:directory?).with("/full/path/template/notname").and_return(true)
40
- start_template = mock(:start_template)
41
- start_template.stub!(:full_path).and_return('/full/path/template/name')
42
- start_template.stub!(:full_paths).and_return(['/full/path/template/name'])
43
- start_template.should_receive(:is_a?).with(Template).and_return(true)
37
+ it "creates a Template from a relative Template path" do
38
+ expect(Engine).to receive(:template_paths).and_return([])
39
+ expect(File).to receive(:directory?).with("/full/path/template/notname").and_return(true)
40
+ start_template = double(:start_template,
41
+ :full_path => '/full/path/template/name',
42
+ :full_paths => ['/full/path/template/name'])
43
+ expect(start_template).to receive(:is_a?).with(Template).and_return(true)
44
44
  mod = Engine.template(start_template, '..', 'notname')
45
- mod.should include(Template)
46
- mod.full_path.to_s.should == "/full/path/template/notname"
45
+ expect(mod).to include(Template)
46
+ expect(mod.full_path.to_s).to eq "/full/path/template/notname"
47
47
  end
48
48
 
49
- it "should create a Template including other matching templates in path" do
49
+ it "creates a Template including other matching templates in path" do
50
50
  paths = ['/full/path/template/name', '/full/path2/template/name']
51
- Engine.should_receive(:find_template_paths).with(nil, 'template').at_least(1).times.and_return([])
52
- Engine.should_receive(:find_template_paths).with(nil, 'template/name').and_return(paths)
51
+ expect(Engine).to receive(:find_template_paths).with(nil, 'template').at_least(1).times.and_return([])
52
+ expect(Engine).to receive(:find_template_paths).with(nil, 'template/name').and_return(paths)
53
53
  ancestors = Engine.template('template/name').ancestors.map {|m| m.class_name }
54
- ancestors.should include("Template__full_path2_template_name")
54
+ expect(ancestors).to include("Template__full_path2_template_name")
55
55
  end
56
56
 
57
- it "should include parent directories before other template paths" do
57
+ it "includes parent directories before other template paths" do
58
58
  paths = ['/full/path/template/name', '/full/path2/template/name']
59
- Engine.should_receive(:find_template_paths).with(nil, 'template/name').and_return(paths)
59
+ expect(Engine).to receive(:find_template_paths).with(nil, 'template/name').and_return(paths)
60
60
  ancestors = Engine.template('template/name').ancestors.map {|m| m.class_name }
61
- ancestors[0, 4].should == ["Template__full_path_template_name", "Template__full_path_template",
61
+ expect(ancestors[0, 4]).to eq ["Template__full_path_template_name", "Template__full_path_template",
62
62
  "Template__full_path2_template_name", "Template__full_path2_template"]
63
63
  end
64
64
  end
65
65
 
66
- describe '.generate' do
67
- it "should generate with fulldoc template" do
68
- mod = mock(:template)
66
+ describe ".generate" do
67
+ it "generates with fulldoc template" do
68
+ mod = double(:template)
69
69
  options = TemplateOptions.new
70
70
  options.reset_defaults
71
71
  options.objects = [:a, :b, :c]
72
72
  options.object = Registry.root
73
- mod.should_receive(:run).with(options)
74
- Engine.should_receive(:template).with(:default, :fulldoc, :text).and_return(mod)
73
+ expect(mod).to receive(:run).with(options)
74
+ expect(Engine).to receive(:template).with(:default, :fulldoc, :text).and_return(mod)
75
75
  Engine.generate([:a, :b, :c])
76
76
  end
77
77
  end
78
78
 
79
- describe '.render' do
79
+ describe ".render" do
80
80
  def loads_template(*args)
81
- Engine.should_receive(:template).with(*args).and_return(@template)
81
+ expect(Engine).to receive(:template).with(*args).and_return(@template)
82
82
  end
83
83
 
84
84
  before(:all) do
@@ -90,29 +90,28 @@ describe YARD::Templates::Engine do
90
90
  @options.reset_defaults
91
91
  @options.object = @object
92
92
  @options.type = @object.type
93
- @template = mock(:template)
94
- @template.stub!(:include)
95
- @template.should_receive(:run).with(@options)
93
+ @template = double(:template, :include => nil)
94
+ expect(@template).to receive(:run).with(@options)
96
95
  end
97
96
 
98
- it "should accept method call with no parameters" do
97
+ it "accepts method call with no parameters" do
99
98
  loads_template(:default, :method, :text)
100
99
  @object.format
101
100
  end
102
101
 
103
- it "should allow template key to be changed" do
102
+ it "allows template key to be changed" do
104
103
  loads_template(:javadoc, :method, :text)
105
104
  @options.template = :javadoc
106
105
  @object.format(:template => :javadoc)
107
106
  end
108
107
 
109
- it "should allow type key to be changed" do
108
+ it "allows type key to be changed" do
110
109
  loads_template(:default, :fulldoc, :text)
111
110
  @options.type = :fulldoc
112
111
  @object.format(:type => :fulldoc)
113
112
  end
114
113
 
115
- it "should allow format key to be changed" do
114
+ it "allows format key to be changed" do
116
115
  loads_template(:default, :method, :html)
117
116
  @options.format = :html
118
117
  @object.format(:format => :html)
@@ -1,38 +1,44 @@
1
1
  <h1>Class: A
2
2
  <span class="abstract note title">Abstract</span>
3
-
3
+
4
+
4
5
  </h1>
5
-
6
- <dl class="box">
7
-
8
- <dt class="r1">Inherits:</dt>
9
- <dd class="r1">
6
+ <div class="box_info">
7
+
8
+ <dl>
9
+ <dt>Inherits:</dt>
10
+ <dd>
10
11
  <span class="inheritName">B</span>
11
-
12
+
12
13
  <ul class="fullTree">
13
14
  <li>Object</li>
14
-
15
+
15
16
  <li class="next">B</li>
16
-
17
+
17
18
  <li class="next">A</li>
18
-
19
+
19
20
  </ul>
20
21
  <a href="#" class="inheritanceTree">show all</a>
21
-
22
- </dd>
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
- <dt class="r2 last">Defined in:</dt>
32
- <dd class="r2 last">(stdin)</dd>
33
-
34
- </dl>
35
- <div class="clear"></div>
22
+
23
+ </dd>
24
+ </dl>
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+ <dl>
37
+ <dt>Defined in:</dt>
38
+ <dd>(stdin)</dd>
39
+ </dl>
40
+
41
+ </div>
36
42
 
37
43
  <h2>Overview</h2><div class="docstring">
38
44
  <div class="discussion">
@@ -45,42 +51,43 @@ Comments
45
51
  </div>
46
52
  </div>
47
53
  <div class="tags">
54
+
48
55
 
49
56
  <p class="tag_title">See Also:</p>
50
57
  <ul class="see">
51
-
58
+
52
59
  <li>A</li>
53
-
60
+
54
61
  <li><a href="http://example.com" target="_parent" title="Example">Example</a></li>
55
-
62
+
56
63
  </ul>
57
64
  <p class="tag_title">Author:</p>
58
65
  <ul class="author">
59
-
66
+
60
67
  <li>
61
-
62
-
63
-
64
-
65
-
68
+
69
+
70
+
71
+
72
+
66
73
  <div class='inline'>Test</div>
67
-
74
+
68
75
  </li>
69
-
76
+
70
77
  </ul>
71
78
  <p class="tag_title">Version:</p>
72
79
  <ul class="version">
73
-
80
+
74
81
  <li>
75
-
76
-
77
-
78
-
79
-
82
+
83
+
84
+
85
+
86
+
80
87
  <div class='inline'>1.0</div>
81
-
88
+
82
89
  </li>
83
-
90
+
84
91
  </ul>
85
92
 
86
93
  </div><div id="subclasses">
@@ -92,86 +99,100 @@ Comments
92
99
 
93
100
 
94
101
 
95
- <h2>Instance Method Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
96
102
 
97
- <ul class="summary">
98
103
 
104
+
105
+ <h2>
106
+ Instance Method Summary
107
+ <small><a href="#" class="summary_toggle">collapse</a></small>
108
+ </h2>
109
+
110
+ <ul class="summary">
111
+
99
112
  <li class="public deprecated">
100
113
  <span class="summary_signature">
114
+
115
+ <a title="#a (instance method)">#<strong>a</strong> </a>
116
+
101
117
 
102
- <a title="#a (instance method)">- <strong>a</strong> </a>
103
-
104
-
105
-
118
+
106
119
  </span>
107
-
108
-
109
-
110
-
120
+
121
+
122
+
123
+
124
+
111
125
  <span class="deprecated note title">deprecated</span>
126
+
112
127
 
113
-
128
+
114
129
  <span class="summary_desc"><strong>Deprecated.</strong> <div class='inline'></div></span>
115
-
130
+
116
131
  </li>
117
132
 
118
-
133
+
119
134
  <li class="public ">
120
135
  <span class="summary_signature">
136
+
137
+ <a title="#initialize (instance method)">#<strong>initialize</strong>(test) &#x21d2; A </a>
138
+
121
139
 
122
- <a title="#initialize (instance method)">- (A) <strong>initialize</strong>(test) </a>
123
-
124
-
125
-
140
+
126
141
  </span>
127
-
142
+
143
+
128
144
  <span class="note title constructor">constructor</span>
129
-
130
-
131
-
132
-
133
-
134
-
135
-
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+
136
153
  <span class="summary_desc"><div class='inline'>constructor method!.</div></span>
137
-
154
+
138
155
  </li>
139
156
 
140
-
157
+
141
158
  <li class="public ">
142
159
  <span class="summary_signature">
160
+
161
+ <a title="#method_missing (instance method)">#<strong>method_missing</strong>(*args) </a>
162
+
143
163
 
144
- <a title="#method_missing (instance method)">- <strong>method_missing</strong>(*args) </a>
145
-
146
-
147
-
164
+
148
165
  </span>
149
-
150
-
151
-
152
-
153
-
154
-
155
-
166
+
167
+
168
+
169
+
170
+
171
+
172
+
173
+
174
+
156
175
  <span class="summary_desc"><div class='inline'>HI.</div></span>
157
-
176
+
158
177
  </li>
159
178
 
160
-
179
+
161
180
  </ul>
162
-
181
+
163
182
 
164
183
 
165
184
  <div id="constructor_details" class="method_details_list">
166
185
  <h2>Constructor Details</h2>
167
-
186
+
168
187
  <div class="method_details first">
169
188
  <h3 class="signature first" id="initialize-instance_method">
189
+
190
+ #<strong>initialize</strong>(test) &#x21d2; <tt>A</tt>
191
+
170
192
 
171
- - (<tt>A</tt>) <strong>initialize</strong>(test)
172
-
173
-
193
+
174
194
 
195
+
175
196
  </h3><div class="docstring">
176
197
  <div class="discussion">
177
198
  constructor method!
@@ -179,6 +200,7 @@ Comments
179
200
  </div>
180
201
  </div>
181
202
  <div class="tags">
203
+
182
204
 
183
205
  </div><table class="source_code">
184
206
  <tr>
@@ -196,22 +218,24 @@ def initialize(test) end</pre>
196
218
  </tr>
197
219
  </table>
198
220
  </div>
199
-
221
+
200
222
  </div>
201
223
  <div id="method_missing_details" class="method_details_list">
202
224
  <h2>Dynamic Method Handling</h2>
203
225
  <p class="notice this">
204
226
  This class handles dynamic methods through the <tt>method_missing</tt> method
205
-
227
+
206
228
  </p>
207
-
229
+
208
230
  <div class="method_details first">
209
231
  <h3 class="signature first" id="method_missing-instance_method">
232
+
233
+ #<strong>method_missing</strong>(*args)
234
+
210
235
 
211
- - <strong>method_missing</strong>(*args)
212
-
213
-
236
+
214
237
 
238
+
215
239
  </h3><div class="docstring">
216
240
  <div class="discussion">
217
241
  HI
@@ -219,6 +243,7 @@ def initialize(test) end</pre>
219
243
  </div>
220
244
  </div>
221
245
  <div class="tags">
246
+
222
247
 
223
248
  </div><table class="source_code">
224
249
  <tr>
@@ -236,21 +261,23 @@ def method_missing(*args) end</pre>
236
261
  </tr>
237
262
  </table>
238
263
  </div>
239
-
264
+
240
265
  </div>
241
266
 
242
267
 
243
268
  <div id="instance_method_details" class="method_details_list">
244
269
  <h2>Instance Method Details</h2>
245
270
 
246
-
271
+
247
272
  <div class="method_details first">
248
273
  <h3 class="signature first" id="a-instance_method">
274
+
275
+ #<strong>a</strong>
276
+
249
277
 
250
- - <strong>a</strong>
251
-
252
-
278
+
253
279
 
280
+
254
281
  </h3><div class="docstring">
255
282
  <div class="discussion">
256
283
  <div class="note deprecated"><strong>Deprecated.</strong> <div class='inline'></div></div>
@@ -259,6 +286,7 @@ def method_missing(*args) end</pre>
259
286
  </div>
260
287
  </div>
261
288
  <div class="tags">
289
+
262
290
 
263
291
  </div><table class="source_code">
264
292
  <tr>
@@ -276,5 +304,5 @@ def a; end</pre>
276
304
  </tr>
277
305
  </table>
278
306
  </div>
279
-
307
+
280
308
  </div>