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
@@ -26,14 +26,14 @@ describe YARD::CLI::Stats do
26
26
 
27
27
  @output = StringIO.new
28
28
  @stats = CLI::Stats.new(false)
29
- @stats.stub!(:support_rdoc_document_file!).and_return([])
30
- @stats.stub!(:yardopts).and_return([])
31
- log.stub!(:puts) {|*args| @output << args.join("\n") << "\n" }
29
+ allow(@stats).to receive(:support_rdoc_document_file!).and_return([])
30
+ allow(@stats).to receive(:yardopts).and_return([])
31
+ allow(log).to receive(:puts) {|*args| @output << args.join("\n") << "\n" }
32
32
  end
33
33
 
34
- it "should list undocumented objects with --list-undoc" do
34
+ it "lists undocumented objects with --list-undoc when there are undocumented objects" do
35
35
  @stats.run('--list-undoc')
36
- @output.string.should == <<-eof
36
+ expect(@output.string).to eq <<-eof
37
37
  #{@main_stats}
38
38
  Undocumented Objects:
39
39
 
@@ -45,14 +45,14 @@ A#foo
45
45
  eof
46
46
  end
47
47
 
48
- it "should list no undocumented objects with --list-undoc when objects are undocumented" do
48
+ it "lists no undocumented objects with --list-undoc when there is nothing undocumented" do
49
49
  Registry.clear
50
50
  YARD.parse_string <<-eof
51
51
  # documentation
52
52
  def foo; end
53
53
  eof
54
54
  @stats.run('--list-undoc')
55
- @output.string.should == "Files: 1\n" +
55
+ expect(@output.string).to eq "Files: 1\n" +
56
56
  "Modules: 0 ( 0 undocumented)\n" +
57
57
  "Classes: 0 ( 0 undocumented)\n" +
58
58
  "Constants: 0 ( 0 undocumented)\n" +
@@ -60,9 +60,9 @@ eof
60
60
  " 100.00% documented\n"
61
61
  end
62
62
 
63
- it "should list undocumented objects in compact mode with --list-undoc --compact" do
63
+ it "lists undocumented objects in compact mode with --list-undoc --compact" do
64
64
  @stats.run('--list-undoc', '--compact')
65
- @output.string.should == <<-eof
65
+ expect(@output.string).to eq <<-eof
66
66
  #{@main_stats}
67
67
  Undocumented Objects:
68
68
  B ((stdin):9)
@@ -72,19 +72,19 @@ A#foo ((stdin):4)
72
72
  eof
73
73
  end
74
74
 
75
- it "should still list stats with --quiet" do
75
+ it "still lists stats with --quiet" do
76
76
  @stats.run('--quiet')
77
- @output.string.should == @main_stats
77
+ expect(@output.string).to eq @main_stats
78
78
  end
79
79
 
80
- it "should ignore everything with --no-public" do
80
+ it "ignores everything with --no-public" do
81
81
  @stats.run('--no-public')
82
- @output.string.should ==
82
+ expect(@output.string).to eq(
83
83
  "Files: 0\n" +
84
84
  "Modules: 0 ( 0 undocumented)\n" +
85
85
  "Classes: 0 ( 0 undocumented)\n" +
86
86
  "Constants: 0 ( 0 undocumented)\n" +
87
87
  "Methods: 0 ( 0 undocumented)\n" +
88
- " 100.00% documented\n"
88
+ " 100.00% documented\n")
89
89
  end
90
90
  end
@@ -7,290 +7,290 @@ describe YARD::CLI::Yardoc do
7
7
  @yardoc.use_document_file = false
8
8
  @yardoc.use_yardopts_file = false
9
9
  @yardoc.generate = false
10
- Templates::Engine.stub!(:render)
11
- Templates::Engine.stub!(:generate)
12
- YARD.stub!(:parse)
13
- Registry.stub!(:load)
14
- Registry.stub!(:save)
10
+ allow(Templates::Engine).to receive(:render)
11
+ allow(Templates::Engine).to receive(:generate)
12
+ allow(YARD).to receive(:parse)
13
+ allow(Registry).to receive(:load)
14
+ allow(Registry).to receive(:save)
15
15
  end
16
16
 
17
- describe 'Defaults' do
17
+ describe "Defaults" do
18
18
  before do
19
19
  @yardoc = CLI::Yardoc.new
20
- @yardoc.stub!(:yardopts).and_return([])
21
- @yardoc.stub!(:support_rdoc_document_file!).and_return([])
20
+ allow(@yardoc).to receive(:yardopts).and_return([])
21
+ allow(@yardoc).to receive(:support_rdoc_document_file!).and_return([])
22
22
  @yardoc.parse_arguments
23
23
  end
24
24
 
25
- it "should use cache by default" do
26
- @yardoc.use_cache.should == false
25
+ it "does not use cache by default" do
26
+ expect(@yardoc.use_cache).to be false
27
27
  end
28
28
 
29
- it "print statistics by default" do
30
- @yardoc.statistics.should == true
29
+ it "prints statistics by default" do
30
+ expect(@yardoc.statistics).to be true
31
31
  end
32
32
 
33
- it "should generate output by default" do
34
- @yardoc.generate.should == true
33
+ it "generates output by default" do
34
+ expect(@yardoc.generate).to be true
35
35
  end
36
36
 
37
- it "should read .yardopts by default" do
38
- @yardoc.use_yardopts_file.should == true
37
+ it "reads .yardopts by default" do
38
+ expect(@yardoc.use_yardopts_file).to be true
39
39
  end
40
40
 
41
- it "should read .document by default" do
42
- @yardoc.use_document_file.should == true
41
+ it "reads .document by default" do
42
+ expect(@yardoc.use_document_file).to be true
43
43
  end
44
44
 
45
- it "should use {lib,app}/**/*.rb and ext/**/*.c as default file glob" do
46
- @yardoc.files.should == ['{lib,app}/**/*.rb', 'ext/**/*.c']
45
+ it "uses lib, app, and ext as default file glob paths" do
46
+ expect(@yardoc.files).to eq Parser::SourceParser::DEFAULT_PATH_GLOB
47
47
  end
48
48
 
49
- it "should use rdoc as default markup type (but falls back on none)" do
50
- @yardoc.options.markup.should == :rdoc
49
+ it "uses rdoc as default markup type (but falls back on none)" do
50
+ expect(@yardoc.options.markup).to eq :rdoc
51
51
  end
52
52
 
53
- it "should use default as default template" do
54
- @yardoc.options.template.should == :default
53
+ it "uses default as default template" do
54
+ expect(@yardoc.options.template).to eq :default
55
55
  end
56
56
 
57
- it "should use HTML as default format" do
58
- @yardoc.options.format.should == :html
57
+ it "uses HTML as default format" do
58
+ expect(@yardoc.options.format).to eq :html
59
59
  end
60
60
 
61
- it "should use 'Object' as default return type" do
62
- @yardoc.options.default_return.should == 'Object'
61
+ it "uses 'Object' as default return type" do
62
+ expect(@yardoc.options.default_return).to eq 'Object'
63
63
  end
64
64
 
65
- it "should not hide void return types by default" do
66
- @yardoc.options.hide_void_return.should == false
65
+ it "does not hide void return types by default" do
66
+ expect(@yardoc.options.hide_void_return).to be false
67
67
  end
68
68
 
69
- it "should only show public visibility by default" do
70
- @yardoc.visibilities.should == [:public]
69
+ it "only shows public visibility by default" do
70
+ expect(@yardoc.visibilities).to eq [:public]
71
71
  end
72
72
 
73
- it "should not list objects by default" do
74
- @yardoc.list.should == false
73
+ it "does not list objects by default" do
74
+ expect(@yardoc.list).to be false
75
75
  end
76
76
 
77
- it "should not embed mixins by default" do
78
- @yardoc.options.embed_mixins.should be_empty
77
+ it "does not embed mixins by default" do
78
+ expect(@yardoc.options.embed_mixins).to be_empty
79
79
  end
80
80
 
81
- it "should not set any locale by default" do
82
- @yardoc.options.locale.should be_nil
81
+ it "does not set any locale by default" do
82
+ expect(@yardoc.options.locale).to be nil
83
83
  end
84
84
  end
85
85
 
86
- describe 'General options' do
86
+ describe "General options" do
87
87
  def self.should_accept(*args, &block)
88
88
  @counter ||= 0
89
89
  @counter += 1
90
90
  counter = @counter
91
91
  args.each do |arg|
92
92
  define_method("test_options_#{@counter}", &block)
93
- it("should accept #{arg}") { send("test_options_#{counter}", arg) }
93
+ it("accepts #{arg}") { send("test_options_#{counter}", arg) }
94
94
  end
95
95
  end
96
96
 
97
97
  should_accept('--single-db') do |arg|
98
98
  @yardoc.parse_arguments(arg)
99
- Registry.single_object_db.should == true
99
+ expect(Registry.single_object_db).to be true
100
100
  Registry.single_object_db = nil
101
101
  end
102
102
 
103
103
  should_accept('--no-single-db') do |arg|
104
104
  @yardoc.parse_arguments(arg)
105
- Registry.single_object_db.should == false
105
+ expect(Registry.single_object_db).to be false
106
106
  Registry.single_object_db = nil
107
107
  end
108
108
 
109
109
  should_accept('-c', '--use-cache') do |arg|
110
110
  @yardoc.parse_arguments(arg)
111
- @yardoc.use_cache.should == true
111
+ expect(@yardoc.use_cache).to be true
112
112
  end
113
113
 
114
114
  should_accept('--no-cache') do |arg|
115
115
  @yardoc.parse_arguments(arg)
116
- @yardoc.use_cache.should == false
116
+ expect(@yardoc.use_cache).to be false
117
117
  end
118
118
 
119
119
  should_accept('--yardopts') do |arg|
120
120
  @yardoc = CLI::Yardoc.new
121
121
  @yardoc.use_document_file = false
122
- @yardoc.should_receive(:yardopts).at_least(1).times.and_return([])
122
+ expect(@yardoc).to receive(:yardopts).at_least(1).times.and_return([])
123
123
  @yardoc.parse_arguments(arg)
124
- @yardoc.use_yardopts_file.should == true
124
+ expect(@yardoc.use_yardopts_file).to be true
125
125
  @yardoc.parse_arguments('--no-yardopts', arg)
126
- @yardoc.use_yardopts_file.should == true
126
+ expect(@yardoc.use_yardopts_file).to be true
127
127
  end
128
128
 
129
129
  should_accept('--yardopts with filename') do |arg|
130
130
  @yardoc = CLI::Yardoc.new
131
- File.should_receive(:read_binary).with('.foobar').and_return('')
131
+ expect(File).to receive(:read_binary).with('.foobar').and_return('')
132
132
  @yardoc.use_document_file = false
133
133
  @yardoc.parse_arguments('--yardopts', '.foobar')
134
- @yardoc.use_yardopts_file.should == true
135
- @yardoc.options_file.should == '.foobar'
134
+ expect(@yardoc.use_yardopts_file).to be true
135
+ expect(@yardoc.options_file).to eq '.foobar'
136
136
  end
137
137
 
138
138
  should_accept('--no-yardopts') do |arg|
139
139
  @yardoc = CLI::Yardoc.new
140
140
  @yardoc.use_document_file = false
141
- @yardoc.should_not_receive(:yardopts)
141
+ expect(@yardoc).not_to receive(:yardopts)
142
142
  @yardoc.parse_arguments(arg)
143
- @yardoc.use_yardopts_file.should == false
143
+ expect(@yardoc.use_yardopts_file).to be false
144
144
  @yardoc.parse_arguments('--yardopts', arg)
145
- @yardoc.use_yardopts_file.should == false
145
+ expect(@yardoc.use_yardopts_file).to be false
146
146
  end
147
147
 
148
148
  should_accept('--document') do |arg|
149
149
  @yardoc = CLI::Yardoc.new
150
150
  @yardoc.use_yardopts_file = false
151
- @yardoc.should_receive(:support_rdoc_document_file!).and_return([])
151
+ expect(@yardoc).to receive(:support_rdoc_document_file!).and_return([])
152
152
  @yardoc.parse_arguments('--no-document', arg)
153
- @yardoc.use_document_file.should == true
153
+ expect(@yardoc.use_document_file).to be true
154
154
  end
155
155
 
156
156
  should_accept('--no-document') do |arg|
157
157
  @yardoc = CLI::Yardoc.new
158
158
  @yardoc.use_yardopts_file = false
159
- @yardoc.should_not_receive(:support_rdoc_document_file!)
159
+ expect(@yardoc).not_to receive(:support_rdoc_document_file!)
160
160
  @yardoc.parse_arguments('--document', arg)
161
- @yardoc.use_document_file.should == false
161
+ expect(@yardoc.use_document_file).to be false
162
162
  end
163
163
 
164
164
  should_accept('-b', '--db') do |arg|
165
165
  @yardoc.parse_arguments(arg, 'test')
166
- Registry.yardoc_file.should == 'test'
166
+ expect(Registry.yardoc_file).to eq 'test'
167
167
  Registry.yardoc_file = '.yardoc'
168
168
  end
169
169
 
170
170
  should_accept('-n', '--no-output') do |arg|
171
- Templates::Engine.should_not_receive(:generate)
171
+ expect(Templates::Engine).not_to receive(:generate)
172
172
  @yardoc.run(arg)
173
173
  end
174
174
 
175
175
  should_accept('--exclude') do |arg|
176
- YARD.should_receive(:parse).with(['a'], ['nota', 'b'])
176
+ expect(YARD).to receive(:parse).with(['a'], ['nota', 'b'])
177
177
  @yardoc.run(arg, 'nota', arg, 'b', 'a')
178
178
  end
179
179
 
180
180
  should_accept('--no-save') do |arg|
181
- YARD.should_receive(:parse)
182
- Registry.should_not_receive(:save)
181
+ expect(YARD).to receive(:parse)
182
+ expect(Registry).not_to receive(:save)
183
183
  @yardoc.run(arg)
184
184
  end
185
185
  end
186
186
 
187
- describe 'Output options' do
188
- it "should accept --title" do
187
+ describe "Output options" do
188
+ it "accepts --title" do
189
189
  @yardoc.parse_arguments('--title', 'hello world')
190
- @yardoc.options.title.should == 'hello world'
190
+ expect(@yardoc.options.title).to eq 'hello world'
191
191
  end
192
192
 
193
- it "should allow --title to have multiple spaces in .yardopts" do
194
- File.should_receive(:read_binary).with("test").and_return("--title \"Foo Bar\"")
193
+ it "allows --title to have multiple spaces in .yardopts" do
194
+ expect(File).to receive(:read_binary).with("test").and_return("--title \"Foo Bar\"")
195
195
  @yardoc.options_file = "test"
196
196
  @yardoc.use_yardopts_file = true
197
197
  @yardoc.run
198
- @yardoc.options.title.should == "Foo Bar"
198
+ expect(@yardoc.options.title).to eq "Foo Bar"
199
199
  end
200
200
 
201
- it "should alias --main to the --readme flag" do
201
+ it "aliases --main to the --readme flag" do
202
202
  readme = File.join(File.dirname(__FILE__),'..','..','README.md')
203
203
 
204
204
  @yardoc.parse_arguments('--main', readme)
205
- @yardoc.options.readme.should == CodeObjects::ExtraFileObject.new(readme, '')
205
+ expect(@yardoc.options.readme).to eq CodeObjects::ExtraFileObject.new(readme, '')
206
206
  end
207
207
 
208
- it "should select a markup provider when --markup-provider or -mp is set" do
208
+ it "selects a markup provider when --markup-provider or -mp is set" do
209
209
  @yardoc.parse_arguments("-M", "test")
210
- @yardoc.options.markup_provider.should == :test
210
+ expect(@yardoc.options.markup_provider).to eq :test
211
211
  @yardoc.parse_arguments("--markup-provider", "test2")
212
- @yardoc.options.markup_provider.should == :test2
212
+ expect(@yardoc.options.markup_provider).to eq :test2
213
213
  end
214
214
 
215
- it "should select a markup format when -m is set" do
216
- @yardoc.should_receive(:verify_markup_options).and_return(true)
215
+ it "selects a markup format when -m is set" do
216
+ expect(@yardoc).to receive(:verify_markup_options).and_return(true)
217
217
  @yardoc.generate = true
218
218
  @yardoc.parse_arguments('-m', 'markdown')
219
- @yardoc.options.markup.should == :markdown
219
+ expect(@yardoc.options.markup).to eq :markdown
220
220
  end
221
221
 
222
- it "should accept --default-return" do
222
+ it "accepts --default-return" do
223
223
  @yardoc.parse_arguments *%w( --default-return XYZ )
224
- @yardoc.options.default_return.should == "XYZ"
224
+ expect(@yardoc.options.default_return).to eq "XYZ"
225
225
  end
226
226
 
227
- it "should allow --hide-void-return to be set" do
227
+ it "allows --hide-void-return to be set" do
228
228
  @yardoc.parse_arguments *%w( --hide-void-return )
229
- @yardoc.options.hide_void_return.should be_true
229
+ expect(@yardoc.options.hide_void_return).to be true
230
230
  end
231
231
 
232
- it "should accept --embed-mixins" do
232
+ it "accepts --embed-mixins" do
233
233
  @yardoc.parse_arguments *%w( --embed-mixins )
234
- @yardoc.options.embed_mixins.should == ['*']
234
+ expect(@yardoc.options.embed_mixins).to eq ['*']
235
235
  end
236
236
 
237
- it "should accept --embed-mixin MODULE" do
237
+ it "accepts --embed-mixin MODULE" do
238
238
  @yardoc.parse_arguments *%w( --embed-mixin MyModule )
239
- @yardoc.options.embed_mixins.should == ['MyModule']
239
+ expect(@yardoc.options.embed_mixins).to eq ['MyModule']
240
240
  end
241
241
 
242
- it "should generate all objects with --use-cache" do
243
- YARD.should_receive(:parse)
244
- Registry.should_receive(:load)
245
- Registry.should_receive(:load_all)
246
- @yardoc.stub!(:generate).and_return(true)
242
+ it "generates all objects with --use-cache" do
243
+ expect(YARD).to receive(:parse)
244
+ expect(Registry).to receive(:load)
245
+ expect(Registry).to receive(:load_all)
246
+ allow(@yardoc).to receive(:generate).and_return(true)
247
247
  @yardoc.run *%w( --use-cache )
248
248
  end
249
249
 
250
- it "should not print statistics with --no-stats" do
251
- @yardoc.stub!(:statistics).and_return(false)
252
- CLI::Stats.should_not_receive(:new)
250
+ it "does not print statistics with --no-stats" do
251
+ allow(@yardoc).to receive(:statistics).and_return(false)
252
+ expect(CLI::Stats).not_to receive(:new)
253
253
  @yardoc.run *%w( --no-stats )
254
254
  end
255
255
 
256
- describe '--asset' do
256
+ describe "--asset" do
257
257
  before do
258
258
  @yardoc.generate = true
259
- @yardoc.stub!(:run_generate)
259
+ allow(@yardoc).to receive(:run_generate)
260
260
  end
261
261
 
262
- it "should copy assets to output directory" do
263
- FileUtils.should_receive(:cp_r).with('a', 'doc/a')
262
+ it "copies assets to output directory" do
263
+ expect(FileUtils).to receive(:cp_r).with('a', 'doc/a')
264
264
  @yardoc.run *%w( --asset a )
265
- @yardoc.assets.should == {'a' => 'a'}
265
+ expect(@yardoc.assets).to eq({'a' => 'a'})
266
266
  end
267
267
 
268
- it "should allow multiple --asset options" do
269
- FileUtils.should_receive(:cp_r).with('a', 'doc/a')
270
- FileUtils.should_receive(:cp_r).with('b', 'doc/b')
268
+ it "allows multiple --asset options" do
269
+ expect(FileUtils).to receive(:cp_r).with('a', 'doc/a')
270
+ expect(FileUtils).to receive(:cp_r).with('b', 'doc/b')
271
271
  @yardoc.run *%w( --asset a --asset b )
272
- @yardoc.assets.should == {'a' => 'a', 'b' => 'b'}
272
+ expect(@yardoc.assets).to eq({'a' => 'a', 'b' => 'b'})
273
273
  end
274
274
 
275
- it "should not allow from or to to refer to a path above current path" do
276
- log.should_receive(:warn).exactly(4).times.with(/invalid/i)
275
+ it "does not allow from or to to refer to a path above current path" do
276
+ expect(log).to receive(:warn).exactly(4).times.with(/invalid/i)
277
277
  @yardoc.run *%w( --asset ../../../etc/passwd )
278
- @yardoc.assets.should be_empty
278
+ expect(@yardoc.assets).to be_empty
279
279
  @yardoc.run *%w( --asset a/b/c/d/../../../../../../etc/passwd )
280
- @yardoc.assets.should be_empty
280
+ expect(@yardoc.assets).to be_empty
281
281
  @yardoc.run *%w( --asset /etc/passwd )
282
- @yardoc.assets.should be_empty
282
+ expect(@yardoc.assets).to be_empty
283
283
  @yardoc.run *%w( --asset normal:/etc/passwd )
284
- @yardoc.assets.should be_empty
284
+ expect(@yardoc.assets).to be_empty
285
285
  end
286
286
 
287
- it "should allow from:to syntax" do
288
- FileUtils.should_receive(:cp_r).with('foo', 'doc/bar')
287
+ it "allows from:to syntax" do
288
+ expect(FileUtils).to receive(:cp_r).with('foo', 'doc/bar')
289
289
  @yardoc.run *%w( --asset foo:bar )
290
- @yardoc.assets.should == {'foo' => 'bar'}
290
+ expect(@yardoc.assets).to eq({'foo' => 'bar'})
291
291
  end
292
292
 
293
- it "should not put from inside of to/ if from is a directory" do
293
+ it "does not put from inside of to/ if from is a directory" do
294
294
  begin
295
295
  from = 'tmp_foo'
296
296
  to = 'tmp_bar'
@@ -299,8 +299,8 @@ describe YARD::CLI::Yardoc do
299
299
  @yardoc.options.serializer.basepath = File.dirname(__FILE__)
300
300
  @yardoc.run("--asset", "#{from}:#{to}")
301
301
  @yardoc.run("--asset", "#{from}:#{to}")
302
- File.directory?(full_to).should be_true
303
- File.directory?(File.join(full_to, 'tmp_foo')).should be_false
302
+ expect(File.directory?(full_to)).to be true
303
+ expect(File.directory?(File.join(full_to, 'tmp_foo'))).to be false
304
304
  ensure
305
305
  FileUtils.rm_rf(from)
306
306
  FileUtils.rm_rf(full_to)
@@ -308,37 +308,37 @@ describe YARD::CLI::Yardoc do
308
308
  end
309
309
  end
310
310
 
311
- describe '--locale' do
312
- it 'should apply specified locale to all extra file objects' do
313
- File.stub!(:read).with('extra_file1').and_return('')
314
- File.stub!(:read).with('extra_file2').and_return('')
311
+ describe "--locale" do
312
+ it "applies specified locale to all extra file objects" do
313
+ allow(File).to receive(:read).with('extra_file1').and_return('')
314
+ allow(File).to receive(:read).with('extra_file2').and_return('')
315
315
 
316
316
  extra_file_object1 = CodeObjects::ExtraFileObject.new('extra_file1')
317
317
  extra_file_object2 = CodeObjects::ExtraFileObject.new('extra_file2')
318
- extra_file_object1.should_receive(:locale=).with('fr')
319
- extra_file_object2.should_receive(:locale=).with('fr')
320
-
321
- CodeObjects::ExtraFileObject.stub!(:new).with('extra_file1').and_return(extra_file_object1)
322
- CodeObjects::ExtraFileObject.stub!(:new).with('extra_file2').and_return(extra_file_object2)
323
- Dir.stub!(:glob).with('README{,*[^~]}').and_return([])
324
- File.stub!(:file?).with('extra_file1').and_return(true)
325
- File.stub!(:file?).with('extra_file2').and_return(true)
318
+ expect(extra_file_object1).to receive(:locale=).with('fr')
319
+ expect(extra_file_object2).to receive(:locale=).with('fr')
320
+
321
+ allow(CodeObjects::ExtraFileObject).to receive(:new).with('extra_file1').and_return(extra_file_object1)
322
+ allow(CodeObjects::ExtraFileObject).to receive(:new).with('extra_file2').and_return(extra_file_object2)
323
+ allow(Dir).to receive(:glob).with('README{,*[^~]}').and_return([])
324
+ allow(File).to receive(:file?).with('extra_file1').and_return(true)
325
+ allow(File).to receive(:file?).with('extra_file2').and_return(true)
326
326
  @yardoc.run('--locale=fr', '-', 'extra_file1', 'extra_file2')
327
327
  end
328
328
  end
329
329
 
330
- describe '--po-dir' do
331
- it 'should set Registry.po_dir' do
332
- Registry.should_receive(:po_dir=).with("locale")
330
+ describe "--po-dir" do
331
+ it "sets Registry.po_dir" do
332
+ expect(Registry).to receive(:po_dir=).with("locale")
333
333
  @yardoc.run('--po-dir=locale')
334
334
  end
335
335
  end
336
336
  end
337
337
 
338
- describe '--[no-]api' do
338
+ describe "--[no-]api" do
339
339
  before { Registry.clear }
340
340
 
341
- it "should allow --api name" do
341
+ it "allows --api name" do
342
342
  YARD.parse_string <<-eof
343
343
  # @api private
344
344
  class Foo; end
@@ -347,10 +347,10 @@ describe YARD::CLI::Yardoc do
347
347
  class Baz; end
348
348
  eof
349
349
  @yardoc.run('--api', 'private')
350
- @yardoc.options.verifier.run(Registry.all).should == [P('Foo')]
350
+ expect(@yardoc.options.verifier.run(Registry.all)).to eq [P('Foo')]
351
351
  end
352
352
 
353
- it "should allow multiple --api's to all be shown" do
353
+ it "allows multiple --api's to all be shown" do
354
354
  YARD.parse_string <<-eof
355
355
  # @api private
356
356
  class Foo; end
@@ -359,11 +359,11 @@ describe YARD::CLI::Yardoc do
359
359
  class Baz; end
360
360
  eof
361
361
  @yardoc.run('--api', 'private', '--api', 'public')
362
- @yardoc.options.verifier.run(Registry.all).
363
- sort_by {|o| o.path }.should == [P('Bar'), P('Foo')]
362
+ expect(@yardoc.options.verifier.run(Registry.all).
363
+ sort_by {|o| o.path }).to eq [P('Bar'), P('Foo')]
364
364
  end
365
365
 
366
- it "should allow --no-api to specify objects with no @api tag" do
366
+ it "allows --no-api to specify objects with no @api tag" do
367
367
  YARD.parse_string <<-eof
368
368
  # @api private
369
369
  class Foo; end
@@ -372,13 +372,13 @@ describe YARD::CLI::Yardoc do
372
372
  class Baz; end
373
373
  eof
374
374
  @yardoc.run('--api', '')
375
- @yardoc.options.verifier.run(Registry.all).should == [P('Baz')]
375
+ expect(@yardoc.options.verifier.run(Registry.all)).to eq [P('Baz')]
376
376
  @yardoc.options.verifier = Verifier.new
377
377
  @yardoc.run('--no-api')
378
- @yardoc.options.verifier.run(Registry.all).should == [P('Baz')]
378
+ expect(@yardoc.options.verifier.run(Registry.all)).to eq [P('Baz')]
379
379
  end
380
380
 
381
- it "should allow --no-api to work with other --api switches" do
381
+ it "allows --no-api to work with other --api switches" do
382
382
  YARD.parse_string <<-eof
383
383
  # @api private
384
384
  class Foo; end
@@ -387,21 +387,21 @@ describe YARD::CLI::Yardoc do
387
387
  class Baz; end
388
388
  eof
389
389
  @yardoc.run('--no-api', '--api', 'public')
390
- @yardoc.options.verifier.run(Registry.all).
391
- sort_by {|o| o.path }.should == [P('Bar'), P('Baz')]
390
+ expect(@yardoc.options.verifier.run(Registry.all).
391
+ sort_by {|o| o.path }).to eq [P('Bar'), P('Baz')]
392
392
  end
393
393
 
394
- it "should ensure Ruby code cannot be used" do
394
+ it "ensures Ruby code cannot be used" do
395
395
  [':symbol', '42', '"; exit'].each do |ruby|
396
396
  @yardoc.options.verifier.expressions = []
397
397
  @yardoc.run('--api', ruby)
398
- @yardoc.options.verifier.expressions[1].should include(ruby.inspect)
398
+ expect(@yardoc.options.verifier.expressions[1]).to include(ruby.inspect)
399
399
  end
400
400
  end
401
401
  end
402
402
 
403
- describe '--hide-api option' do
404
- it "should allow --hide-api to hide objects with api tags" do
403
+ describe "--hide-api option" do
404
+ it "allows --hide-api to hide objects with api tags" do
405
405
  YARD.parse_string <<-eof
406
406
  # @api private
407
407
  class Foo; end
@@ -409,11 +409,11 @@ describe YARD::CLI::Yardoc do
409
409
  class Baz; end
410
410
  eof
411
411
  @yardoc.run('--hide-api', 'private')
412
- @yardoc.options.verifier.run(Registry.all).
413
- sort_by {|o| o.path }.should == [P('Bar'), P('Baz')]
412
+ expect(@yardoc.options.verifier.run(Registry.all).
413
+ sort_by {|o| o.path }).to eq [P('Bar'), P('Baz')]
414
414
  end
415
415
 
416
- it "should allow --hide-api to work with --api" do
416
+ it "allows --hide-api to work with --api" do
417
417
  YARD.parse_string <<-eof
418
418
  # @api private
419
419
  class Foo; end
@@ -422,59 +422,54 @@ describe YARD::CLI::Yardoc do
422
422
  class Baz; end
423
423
  eof
424
424
  @yardoc.run('--api', 'public', '--hide-api', 'private')
425
- @yardoc.options.verifier.run(Registry.all).
426
- sort_by {|o| o.path }.should == [P('Bar')]
425
+ expect(@yardoc.options.verifier.run(Registry.all).
426
+ sort_by {|o| o.path }).to eq [P('Bar')]
427
427
  end
428
428
  end
429
429
 
430
- describe '--no-private option' do
431
- it "should accept --no-private" do
432
- obj = mock(:object)
433
- obj.should_receive(:tag).ordered.with(:private).and_return(true)
430
+ describe "--no-private option" do
431
+ it "accepts --no-private" do
432
+ obj = double(:object)
433
+ expect(obj).to receive(:tag).ordered.with(:private).and_return(true)
434
434
  @yardoc.parse_arguments *%w( --no-private )
435
- @yardoc.options.verifier.call(obj).should == false
435
+ expect(@yardoc.options.verifier.call(obj)).to be false
436
436
  end
437
437
 
438
- it "should hide object if namespace is @private with --no-private" do
439
- ns = mock(:namespace)
440
- ns.stub!(:type).and_return(:module)
441
- ns.should_receive(:tag).with(:private).and_return(true)
442
- obj = mock(:object)
443
- obj.stub!(:namespace).and_return(ns)
444
- obj.should_receive(:tag).with(:private).and_return(false)
438
+ it "hides object if namespace is @private with --no-private" do
439
+ ns = double(:namespace, :type => :module)
440
+ expect(ns).to receive(:tag).with(:private).and_return(true)
441
+ obj = double(:object, :namespace => ns)
442
+ expect(obj).to receive(:tag).with(:private).and_return(false)
445
443
  @yardoc.parse_arguments *%w( --no-private )
446
- @yardoc.options.verifier.call(obj).should == false
447
- end
448
-
449
- it "should not call #tag on namespace if namespace is proxy with --no-private" do
450
- ns = mock(:namespace)
451
- ns.should_receive(:is_a?).with(CodeObjects::Proxy).and_return(true)
452
- ns.should_not_receive(:tag)
453
- obj = mock(:object)
454
- obj.stub!(:type).and_return(:class)
455
- obj.stub!(:namespace).and_return(ns)
456
- obj.stub!(:visibility).and_return(:public)
457
- obj.should_receive(:tag).ordered.with(:private).and_return(false)
444
+ expect(@yardoc.options.verifier.call(obj)).to be false
445
+ end
446
+
447
+ it "does not call #tag on namespace if namespace is proxy with --no-private" do
448
+ ns = double(:namespace)
449
+ expect(ns).to receive(:is_a?).with(CodeObjects::Proxy).and_return(true)
450
+ expect(ns).not_to receive(:tag)
451
+ obj = double(:object, :type => :class, :namespace => ns, :visibility => :public)
452
+ expect(obj).to receive(:tag).ordered.with(:private).and_return(false)
458
453
  @yardoc.parse_arguments *%w( --no-private )
459
- @yardoc.options.verifier.call(obj).should == true
454
+ expect(@yardoc.options.verifier.call(obj)).to be true
460
455
  end
461
456
 
462
457
  # @bug gh-197
463
- it "should not call #tag on namespace if namespace is proxy with --no-private" do
458
+ it "does not call #tag on namespace if namespace is proxy with --no-private" do
464
459
  Registry.clear
465
460
  YARD.parse_string "module Qux; class Foo::Bar; end; end"
466
461
  foobar = Registry.at('Foo::Bar')
467
462
  foobar.namespace.type = :module
468
463
  @yardoc.parse_arguments *%w( --no-private )
469
- @yardoc.options.verifier.call(foobar).should == true
464
+ expect(@yardoc.options.verifier.call(foobar)).to be true
470
465
  end
471
466
 
472
- it "should not call #tag on proxy object" do # @bug gh-197
467
+ it "does not call #tag on proxy object" do # @bug gh-197
473
468
  @yardoc.parse_arguments *%w( --no-private )
474
- @yardoc.options.verifier.call(P('ProxyClass')).should == true
469
+ expect(@yardoc.options.verifier.call(P('ProxyClass'))).to be true
475
470
  end
476
471
 
477
- it "should hide methods inside a 'private' class/module with --no-private" do
472
+ it "hides methods inside a 'private' class/module with --no-private" do
478
473
  Registry.clear
479
474
  YARD.parse_string <<-eof
480
475
  # @private
@@ -483,321 +478,321 @@ describe YARD::CLI::Yardoc do
483
478
  end
484
479
  eof
485
480
  @yardoc.parse_arguments *%w( --no-private )
486
- @yardoc.options.verifier.call(Registry.at('ABC')).should be_false
487
- @yardoc.options.verifier.call(Registry.at('ABC#foo')).should be_false
481
+ expect(@yardoc.options.verifier.call(Registry.at('ABC'))).to be false
482
+ expect(@yardoc.options.verifier.call(Registry.at('ABC#foo'))).to be false
488
483
  end
489
484
  end
490
485
 
491
- describe '.yardopts and .document handling' do
486
+ describe ".yardopts and .document handling" do
492
487
  before do
493
488
  @yardoc.use_yardopts_file = true
494
489
  end
495
490
 
496
- it "should search for and use yardopts file specified by #options_file" do
497
- File.should_receive(:read_binary).with("test").and_return("-o \n\nMYPATH\nFILE1 FILE2")
491
+ it "searches for and uses yardopts file specified by #options_file" do
492
+ expect(File).to receive(:read_binary).with("test").and_return("-o \n\nMYPATH\nFILE1 FILE2")
498
493
  @yardoc.use_document_file = false
499
494
  @yardoc.options_file = "test"
500
495
  @yardoc.run
501
- @yardoc.options.serializer.options[:basepath].should == "MYPATH"
502
- @yardoc.files.should == ["FILE1", "FILE2"]
496
+ expect(@yardoc.options.serializer.options[:basepath]).to eq "MYPATH"
497
+ expect(@yardoc.files).to eq ["FILE1", "FILE2"]
503
498
  end
504
499
 
505
- it "should use String#shell_split to split .yardopts tokens" do
500
+ it "uses String#shell_split to split .yardopts tokens" do
506
501
  optsdata = "foo bar"
507
- optsdata.should_receive(:shell_split)
508
- File.should_receive(:read_binary).with("test").and_return(optsdata)
502
+ expect(optsdata).to receive(:shell_split)
503
+ expect(File).to receive(:read_binary).with("test").and_return(optsdata)
509
504
  @yardoc.options_file = "test"
510
505
  @yardoc.run
511
506
  end
512
507
 
513
- it "should allow opts specified in command line to override yardopts file" do
514
- File.should_receive(:read_binary).with(".yardopts").and_return("-o NOTMYPATH")
508
+ it "allows opts specified in command line to override yardopts file" do
509
+ expect(File).to receive(:read_binary).with(".yardopts").and_return("-o NOTMYPATH")
515
510
  @yardoc.run("-o", "MYPATH", "FILE")
516
- @yardoc.options.serializer.options[:basepath].should == "MYPATH"
517
- @yardoc.files.should == ["FILE"]
511
+ expect(@yardoc.options.serializer.options[:basepath]).to eq "MYPATH"
512
+ expect(@yardoc.files).to eq ["FILE"]
518
513
  end
519
514
 
520
- it "should load the RDoc .document file if found" do
521
- File.should_receive(:read_binary).with(".yardopts").and_return("-o NOTMYPATH")
515
+ it "loads the RDoc .document file if found" do
516
+ expect(File).to receive(:read_binary).with(".yardopts").and_return("-o NOTMYPATH")
522
517
  @yardoc.use_document_file = true
523
- @yardoc.stub!(:support_rdoc_document_file!).and_return(["FILE2", "FILE3"])
518
+ allow(@yardoc).to receive(:support_rdoc_document_file!).and_return(["FILE2", "FILE3"])
524
519
  @yardoc.run("-o", "MYPATH", "FILE1")
525
- @yardoc.options.serializer.options[:basepath].should == "MYPATH"
526
- @yardoc.files.should == ["FILE2", "FILE3", "FILE1"]
520
+ expect(@yardoc.options.serializer.options[:basepath]).to eq "MYPATH"
521
+ expect(@yardoc.files).to eq ["FILE2", "FILE3", "FILE1"]
527
522
  end
528
523
  end
529
524
 
530
- describe 'Query options' do
525
+ describe "Query options" do
531
526
  after { Registry.clear }
532
527
 
533
- it "should hide private constants in with default visibilities" do
528
+ it "hides private constants in with default visibilities" do
534
529
  classobj = CodeObjects::ClassObject.new(:root, :Foo) {|o| o.visibility = :private }
535
530
  @yardoc.run
536
- @yardoc.options.verifier.run([classobj]).should == []
531
+ expect(@yardoc.options.verifier.run([classobj])).to eq []
537
532
  end
538
533
 
539
- it "should setup visibility rules as verifier" do
534
+ it "sets up visibility rules as verifier" do
540
535
  methobj = CodeObjects::MethodObject.new(:root, :test) {|o| o.visibility = :private }
541
- File.should_receive(:read_binary).with("test").and_return("--private")
536
+ expect(File).to receive(:read_binary).with("test").and_return("--private")
542
537
  @yardoc.use_yardopts_file = true
543
538
  @yardoc.options_file = "test"
544
539
  @yardoc.run
545
- @yardoc.options.verifier.call(methobj).should be_true
540
+ expect(@yardoc.options.verifier.call(methobj)).to be true
546
541
  end
547
542
 
548
- it "should accept a --query" do
543
+ it "accepts a --query" do
549
544
  @yardoc.parse_arguments *%w( --query @return )
550
- @yardoc.options.verifier.should be_a(Verifier)
545
+ expect(@yardoc.options.verifier).to be_a(Verifier)
551
546
  end
552
547
 
553
- it "should accept multiple --query arguments" do
554
- obj = mock(:object)
555
- obj.should_receive(:tag).ordered.with('return').and_return(true)
556
- obj.should_receive(:tag).ordered.with('tag').and_return(false)
548
+ it "accepts multiple --query arguments" do
549
+ obj = double(:object)
550
+ expect(obj).to receive(:tag).ordered.with('return').and_return(true)
551
+ expect(obj).to receive(:tag).ordered.with('tag').and_return(false)
557
552
  @yardoc.parse_arguments *%w( --query @return --query @tag )
558
- @yardoc.options.verifier.should be_a(Verifier)
559
- @yardoc.options.verifier.call(obj).should == false
553
+ expect(@yardoc.options.verifier).to be_a(Verifier)
554
+ expect(@yardoc.options.verifier.call(obj)).to be false
560
555
  end
561
556
  end
562
557
 
563
- describe 'Extra file arguments' do
564
- it "should accept extra files if specified after '-' with source files" do
565
- Dir.should_receive(:glob).with('README{,*[^~]}').and_return([])
566
- File.should_receive(:file?).with('extra_file1').and_return(true)
567
- File.should_receive(:file?).with('extra_file2').and_return(true)
568
- File.should_receive(:read).with('extra_file1').and_return('')
569
- File.should_receive(:read).with('extra_file2').and_return('')
558
+ describe "Extra file arguments" do
559
+ it "accepts extra files if specified after '-' with source files" do
560
+ expect(Dir).to receive(:glob).with('README{,*[^~]}').and_return([])
561
+ expect(File).to receive(:file?).with('extra_file1').and_return(true)
562
+ expect(File).to receive(:file?).with('extra_file2').and_return(true)
563
+ expect(File).to receive(:read).with('extra_file1').and_return('')
564
+ expect(File).to receive(:read).with('extra_file2').and_return('')
570
565
  @yardoc.parse_arguments *%w( file1 file2 - extra_file1 extra_file2 )
571
- @yardoc.files.should == %w( file1 file2 )
572
- @yardoc.options.files.should ==
566
+ expect(@yardoc.files).to eq %w( file1 file2 )
567
+ expect(@yardoc.options.files).to eq(
573
568
  [CodeObjects::ExtraFileObject.new('extra_file1', ''),
574
- CodeObjects::ExtraFileObject.new('extra_file2', '')]
569
+ CodeObjects::ExtraFileObject.new('extra_file2', '')])
575
570
  end
576
571
 
577
- it "should accept files section only containing extra files" do
578
- Dir.should_receive(:glob).with('README{,*[^~]}').and_return([])
572
+ it "accepts files section only containing extra files" do
573
+ expect(Dir).to receive(:glob).with('README{,*[^~]}').and_return([])
579
574
  @yardoc.parse_arguments *%w( - LICENSE )
580
- @yardoc.files.should == %w( {lib,app}/**/*.rb ext/**/*.c )
581
- @yardoc.options.files.should == [CodeObjects::ExtraFileObject.new('LICENSE', '')]
575
+ expect(@yardoc.files).to eq Parser::SourceParser::DEFAULT_PATH_GLOB
576
+ expect(@yardoc.options.files).to eq [CodeObjects::ExtraFileObject.new('LICENSE', '')]
582
577
  end
583
578
 
584
- it "should accept globs as extra files" do
585
- Dir.should_receive(:glob).with('README{,*[^~]}').and_return []
586
- Dir.should_receive(:glob).with('*.txt').and_return ['a.txt', 'b.txt']
587
- File.should_receive(:read).with('a.txt').and_return('')
588
- File.should_receive(:read).with('b.txt').and_return('')
589
- File.should_receive(:file?).with('a.txt').and_return(true)
590
- File.should_receive(:file?).with('b.txt').and_return(true)
579
+ it "accepts globs as extra files" do
580
+ expect(Dir).to receive(:glob).with('README{,*[^~]}').and_return []
581
+ expect(Dir).to receive(:glob).with('*.txt').and_return ['a.txt', 'b.txt']
582
+ expect(File).to receive(:read).with('a.txt').and_return('')
583
+ expect(File).to receive(:read).with('b.txt').and_return('')
584
+ expect(File).to receive(:file?).with('a.txt').and_return(true)
585
+ expect(File).to receive(:file?).with('b.txt').and_return(true)
591
586
  @yardoc.parse_arguments *%w( file1 file2 - *.txt )
592
- @yardoc.files.should == %w( file1 file2 )
593
- @yardoc.options.files.should ==
587
+ expect(@yardoc.files).to eq %w( file1 file2 )
588
+ expect(@yardoc.options.files).to eq(
594
589
  [CodeObjects::ExtraFileObject.new('a.txt', ''),
595
- CodeObjects::ExtraFileObject.new('b.txt', '')]
590
+ CodeObjects::ExtraFileObject.new('b.txt', '')])
596
591
  end
597
592
 
598
- it "should warn if extra file is not found" do
599
- log.should_receive(:warn).with(/Could not find extra file: UNKNOWN/)
593
+ it "warns if extra file is not found" do
594
+ expect(log).to receive(:warn).with(/Could not find extra file: UNKNOWN/)
600
595
  @yardoc.parse_arguments *%w( - UNKNOWN )
601
596
  end
602
597
 
603
- it "should warn if readme file is not found" do
604
- log.should_receive(:warn).with(/Could not find readme file: UNKNOWN/)
598
+ it "warns if readme file is not found" do
599
+ expect(log).to receive(:warn).with(/Could not find readme file: UNKNOWN/)
605
600
  @yardoc.parse_arguments *%w( -r UNKNOWN )
606
601
  end
607
602
 
608
- it "should use first file as readme if no readme is specified when using --one-file" do
609
- Dir.should_receive(:glob).with('README{,*[^~]}').and_return []
610
- Dir.should_receive(:glob).with('lib/*.rb').and_return(['lib/foo.rb'])
611
- File.should_receive(:read).with('lib/foo.rb').and_return('')
603
+ it "uses first file as readme if no readme is specified when using --one-file" do
604
+ expect(Dir).to receive(:glob).with('README{,*[^~]}').and_return []
605
+ expect(Dir).to receive(:glob).with('lib/*.rb').and_return(['lib/foo.rb'])
606
+ expect(File).to receive(:read).with('lib/foo.rb').and_return('')
612
607
  @yardoc.parse_arguments *%w( --one-file lib/*.rb )
613
- @yardoc.options.readme.should == CodeObjects::ExtraFileObject.new('lib/foo.rb', '')
608
+ expect(@yardoc.options.readme).to eq CodeObjects::ExtraFileObject.new('lib/foo.rb', '')
614
609
  end
615
610
 
616
- it "should use readme it exists when using --one-file" do
617
- Dir.should_receive(:glob).with('README{,*[^~]}').and_return ['README']
618
- File.should_receive(:read).with('README').and_return('')
611
+ it "uses readme it exists when using --one-file" do
612
+ expect(Dir).to receive(:glob).with('README{,*[^~]}').and_return ['README']
613
+ expect(File).to receive(:read).with('README').and_return('')
619
614
  @yardoc.parse_arguments *%w( --one-file lib/*.rb )
620
- @yardoc.options.readme.should == CodeObjects::ExtraFileObject.new('README', '')
615
+ expect(@yardoc.options.readme).to eq CodeObjects::ExtraFileObject.new('README', '')
621
616
  end
622
617
 
623
- it "should not allow US-ASCII charset when using --one-file" do
618
+ it "does not allow US-ASCII charset when using --one-file" do
624
619
  ienc = Encoding.default_internal
625
620
  eenc = Encoding.default_external
626
- log.should_receive(:warn).with(/not compatible with US-ASCII.*using ASCII-8BIT/)
621
+ expect(log).to receive(:warn).with(/not compatible with US-ASCII.*using ASCII-8BIT/)
627
622
  @yardoc.parse_arguments *%w( --one-file --charset us-ascii )
628
- Encoding.default_internal.name.should == 'ASCII-8BIT'
629
- Encoding.default_external.name.should == 'ASCII-8BIT'
623
+ expect(Encoding.default_internal.name).to eq 'ASCII-8BIT'
624
+ expect(Encoding.default_external.name).to eq 'ASCII-8BIT'
630
625
  Encoding.default_internal = ienc
631
626
  Encoding.default_external = eenc
632
627
  end if defined?(::Encoding)
633
628
  end
634
629
 
635
- describe 'Source file arguments' do
636
- it "should accept no params and parse {lib,app}/**/*.rb ext/**/*.c" do
630
+ describe "Source file arguments" do
631
+ it "accepts no params and parse {lib,app}/**/*.rb ext/**/*.c" do
637
632
  @yardoc.parse_arguments
638
- @yardoc.files.should == %w( {lib,app}/**/*.rb ext/**/*.c )
633
+ expect(@yardoc.files).to eq Parser::SourceParser::DEFAULT_PATH_GLOB
639
634
  end
640
635
  end
641
636
 
642
- describe 'Tags options' do
637
+ describe "Tags options" do
643
638
  def tag_created(switch, factory_method)
644
- visible_tags = mock(:visible_tags)
645
- visible_tags.should_receive(:|).ordered.with([:foo])
646
- visible_tags.should_receive(:-).ordered.with([]).and_return(visible_tags)
647
- Tags::Library.should_receive(:define_tag).with('Foo', :foo, factory_method)
648
- Tags::Library.stub!(:visible_tags=)
649
- Tags::Library.should_receive(:visible_tags).at_least(1).times.and_return(visible_tags)
639
+ visible_tags = double(:visible_tags)
640
+ expect(visible_tags).to receive(:|).ordered.with([:foo])
641
+ expect(visible_tags).to receive(:-).ordered.with([]).and_return(visible_tags)
642
+ expect(Tags::Library).to receive(:define_tag).with('Foo', :foo, factory_method)
643
+ allow(Tags::Library).to receive(:visible_tags=)
644
+ expect(Tags::Library).to receive(:visible_tags).at_least(1).times.and_return(visible_tags)
650
645
  @yardoc.parse_arguments("--#{switch}-tag", 'foo')
651
646
  end
652
647
 
653
648
  def tag_hidden(tag)
654
- visible_tags = mock(:visible_tags)
655
- visible_tags.should_receive(:|).ordered.with([tag])
656
- visible_tags.should_receive(:-).ordered.with([tag]).and_return([])
657
- Tags::Library.should_receive(:define_tag).with(tag.to_s.capitalize, tag, nil)
658
- Tags::Library.stub!(:visible_tags=)
659
- Tags::Library.should_receive(:visible_tags).at_least(1).times.and_return(visible_tags)
649
+ visible_tags = double(:visible_tags)
650
+ expect(visible_tags).to receive(:|).ordered.with([tag])
651
+ expect(visible_tags).to receive(:-).ordered.with([tag]).and_return([])
652
+ expect(Tags::Library).to receive(:define_tag).with(tag.to_s.capitalize, tag, nil)
653
+ allow(Tags::Library).to receive(:visible_tags=)
654
+ expect(Tags::Library).to receive(:visible_tags).at_least(1).times.and_return(visible_tags)
660
655
  end
661
656
 
662
- it "should accept --tag" do
663
- Tags::Library.should_receive(:define_tag).with('Title of Foo', :foo, nil)
657
+ it "accepts --tag" do
658
+ expect(Tags::Library).to receive(:define_tag).with('Title of Foo', :foo, nil)
664
659
  @yardoc.parse_arguments('--tag', 'foo:Title of Foo')
665
660
  end
666
661
 
667
- it "should accept --tag without title (and default to captialized tag name)" do
668
- Tags::Library.should_receive(:define_tag).with('Foo', :foo, nil)
662
+ it "accepts --tag without title (and default to captialized tag name)" do
663
+ expect(Tags::Library).to receive(:define_tag).with('Foo', :foo, nil)
669
664
  @yardoc.parse_arguments('--tag', 'foo')
670
665
  end
671
666
 
672
- it "should only list tag once if declared twice" do
667
+ it "only lists tag once if declared twice" do
673
668
  visible_tags = []
674
- Tags::Library.stub!(:define_tag)
675
- Tags::Library.stub!(:visible_tags).and_return([:foo])
676
- Tags::Library.stub!(:visible_tags=) {|value| visible_tags = value }
669
+ allow(Tags::Library).to receive(:define_tag)
670
+ allow(Tags::Library).to receive(:visible_tags).and_return([:foo])
671
+ allow(Tags::Library).to receive(:visible_tags=) {|value| visible_tags = value }
677
672
  @yardoc.parse_arguments('--tag', 'foo', '--tag', 'foo')
678
- visible_tags.should == [:foo]
673
+ expect(visible_tags).to eq [:foo]
679
674
  end
680
675
 
681
- it "should accept --type-tag" do
676
+ it "accepts --type-tag" do
682
677
  tag_created 'type', :with_types
683
678
  end
684
679
 
685
- it "should accept --type-name-tag" do
680
+ it "accepts --type-name-tag" do
686
681
  tag_created 'type-name', :with_types_and_name
687
682
  end
688
683
 
689
- it "should accept --name-tag" do
684
+ it "accepts --name-tag" do
690
685
  tag_created 'name', :with_name
691
686
  end
692
687
 
693
- it "should accept --title-tag" do
688
+ it "accepts --title-tag" do
694
689
  tag_created 'title', :with_title_and_text
695
690
  end
696
691
 
697
- it "should accept --hide-tag before tag is listed" do
692
+ it "accepts --hide-tag before tag is listed" do
698
693
  tag_hidden(:anewfoo)
699
694
  @yardoc.parse_arguments('--hide-tag', 'anewfoo', '--tag', 'anewfoo')
700
695
  end
701
696
 
702
- it "should accept --hide-tag after tag is listed" do
697
+ it "accepts --hide-tag after tag is listed" do
703
698
  tag_hidden(:anewfoo2)
704
699
  @yardoc.parse_arguments('--tag', 'anewfoo2', '--hide-tag', 'anewfoo2')
705
700
  end
706
701
 
707
- it "should accept --transitive-tag" do
702
+ it "accepts --transitive-tag" do
708
703
  @yardoc.parse_arguments('--transitive-tag', 'foo')
709
- Tags::Library.transitive_tags.should include(:foo)
704
+ expect(Tags::Library.transitive_tags).to include(:foo)
710
705
  end
711
706
 
712
- it "should accept --non-transitive-tag" do
707
+ it "accepts --non-transitive-tag" do
713
708
  Tags::Library.transitive_tags |= [:foo]
714
709
  @yardoc.parse_arguments('--non-transitive-tag', 'foo')
715
- Tags::Library.transitive_tags.should_not include(:foo)
710
+ expect(Tags::Library.transitive_tags).not_to include(:foo)
716
711
  end
717
712
  end
718
713
 
719
- describe 'Safe mode' do
714
+ describe "Safe mode" do
720
715
  before do
721
- YARD::Config.stub!(:options).and_return(:safe_mode => true)
716
+ allow(YARD::Config).to receive(:options).and_return(:safe_mode => true)
722
717
  end
723
718
 
724
- it "should not allow --load or -e in safe mode" do
725
- @yardoc.should_not_receive(:require)
719
+ it "does not allow --load or -e in safe mode" do
720
+ expect(@yardoc).not_to receive(:require)
726
721
  @yardoc.run('--load', 'foo')
727
722
  @yardoc.run('-e', 'foo')
728
723
  end
729
724
 
730
- it "should not allow --query in safe mode" do
725
+ it "does not allow --query in safe mode" do
731
726
  @yardoc.run('--query', 'foo')
732
- @yardoc.options.verifier.expressions.should_not include("foo")
727
+ expect(@yardoc.options.verifier.expressions).not_to include("foo")
733
728
  end
734
729
 
735
- it "should not allow modifying the template paths" do
736
- YARD::Templates::Engine.should_not_receive(:register_template_path)
730
+ it "does not allow modifying the template paths" do
731
+ expect(YARD::Templates::Engine).not_to receive(:register_template_path)
737
732
  @yardoc.run('-p', 'foo')
738
733
  @yardoc.run('--template-path', 'foo')
739
734
  end
740
735
  end
741
736
 
742
- describe 'Markup Loading' do
743
- it "should load rdoc markup if no markup is provided" do
737
+ describe "Markup Loading" do
738
+ it "loads rdoc markup if no markup is provided" do
744
739
  @yardoc.generate = true
745
740
  @yardoc.run
746
- @yardoc.options.markup.should == :rdoc
741
+ expect(@yardoc.options.markup).to eq :rdoc
747
742
  end
748
743
 
749
- it "should load rdoc markup even when no output is specified" do
744
+ it "loads rdoc markup even when no output is specified" do
750
745
  @yardoc.parse_arguments('--no-output')
751
- @yardoc.options.markup.should == :rdoc
746
+ expect(@yardoc.options.markup).to eq :rdoc
752
747
  end
753
748
 
754
- it "should warn if rdoc cannot be loaded and fallback to :none" do
749
+ it "warns if rdoc cannot be loaded and fallback to :none" do
755
750
  mod = YARD::Templates::Helpers::MarkupHelper
756
751
  mod.clear_markup_cache
757
- mod.const_get(:MARKUP_PROVIDERS).should_receive(:[]).with(:rdoc).and_return([{:lib => 'INVALID'}])
758
- log.should_receive(:warn).with(/Could not load default RDoc formatter/)
759
- @yardoc.stub(:generate) { @yardoc.options.files = []; true }
752
+ expect(mod.const_get(:MARKUP_PROVIDERS)).to receive(:[]).with(:rdoc).and_return([{:lib => 'INVALID'}])
753
+ expect(log).to receive(:warn).with(/Could not load default RDoc formatter/)
754
+ allow(@yardoc).to receive(:generate) { @yardoc.options.files = []; true }
760
755
  @yardoc.run
761
- @yardoc.options.markup.should == :none
756
+ expect(@yardoc.options.markup).to eq :none
762
757
  mod.clear_markup_cache
763
758
  end
764
759
 
765
- it "should error immediately if markup for any files are missing" do
760
+ it "returns an error immediately if markup for any files are missing" do
766
761
  mod = YARD::Templates::Helpers::MarkupHelper
767
762
  mod.clear_markup_cache
768
- mod.const_get(:MARKUP_PROVIDERS).should_receive(:[]).with(:markdown).and_return([{:lib => 'INVALID'}])
769
- log.should_receive(:error).with(/Missing 'INVALID' gem for Markdown formatting/)
763
+ expect(mod.const_get(:MARKUP_PROVIDERS)).to receive(:[]).with(:markdown).and_return([{:lib => 'INVALID'}])
764
+ expect(log).to receive(:error).with(/Missing 'INVALID' gem for Markdown formatting/)
770
765
  files = [CodeObjects::ExtraFileObject.new('test.md', '')]
771
- @yardoc.stub(:generate) { @yardoc.options.files = files; true }
766
+ allow(@yardoc).to receive(:generate) { @yardoc.options.files = files; true }
772
767
  @yardoc.run
773
768
  mod.clear_markup_cache
774
769
  end
775
770
 
776
- it "should error immediately if markup for any files are missing (file markup specified in attributes)" do
771
+ it "returns an error immediately if markup for any files are missing (file markup specified in attributes)" do
777
772
  mod = YARD::Templates::Helpers::MarkupHelper
778
773
  mod.clear_markup_cache
779
- mod.const_get(:MARKUP_PROVIDERS).should_receive(:[]).with(:markdown).and_return([{:lib => 'INVALID'}])
780
- log.should_receive(:error).with(/Missing 'INVALID' gem for Markdown formatting/)
774
+ expect(mod.const_get(:MARKUP_PROVIDERS)).to receive(:[]).with(:markdown).and_return([{:lib => 'INVALID'}])
775
+ expect(log).to receive(:error).with(/Missing 'INVALID' gem for Markdown formatting/)
781
776
  files = [CodeObjects::ExtraFileObject.new('test', '# @markup markdown')]
782
- @yardoc.stub(:generate) { @yardoc.options.files = files; true }
777
+ allow(@yardoc).to receive(:generate) { @yardoc.options.files = files; true }
783
778
  @yardoc.run
784
779
  mod.clear_markup_cache
785
780
  end
786
781
  end
787
782
 
788
- describe '#run' do
789
- it "should parse_arguments if run() is called" do
790
- @yardoc.should_receive(:parse_arguments)
783
+ describe "#run" do
784
+ it "parses arguments if run() is called" do
785
+ expect(@yardoc).to receive(:parse_arguments)
791
786
  @yardoc.run
792
787
  end
793
788
 
794
- it "should parse_arguments if run(arg1, arg2, ...) is called" do
795
- @yardoc.should_receive(:parse_arguments)
789
+ it "parses arguments if run(arg1, arg2, ...) is called" do
790
+ expect(@yardoc).to receive(:parse_arguments)
796
791
  @yardoc.run('--private', '-p', 'foo')
797
792
  end
798
793
 
799
- it "should not parse_arguments if run(nil) is called" do
800
- @yardoc.should_not_receive(:parse_arguments)
794
+ it "does not parse arguments if run(nil) is called" do
795
+ expect(@yardoc).not_to receive(:parse_arguments)
801
796
  @yardoc.run(nil)
802
797
  end
803
798
  end