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
@@ -1,20 +1,19 @@
1
1
  require File.dirname(__FILE__) + '/spec_helper'
2
2
 
3
3
  describe YARD::Server::WebrickServlet do
4
- describe '#do_GET' do
5
- it "should perform a GET" do
4
+ describe "#do_GET" do
5
+ it "performs a GET" do
6
6
  resp = OpenStruct.new
7
7
  class << resp
8
8
  def []=(name, value) (self.headers ||= {})[name] = value end
9
9
  end
10
- server = mock(:server)
11
- server.stub!(:[])
10
+ server = double(:server, :[] => nil)
12
11
  adapter = mock_adapter
13
12
  adapter.router = proc { [200, {'Header' => 'foo'}, ['body']]}
14
13
  WebrickServlet.new(server, adapter).do_GET(mock_request('/foo'), resp)
15
- resp.status.should == 200
16
- resp.headers.should == {'Header' => 'foo'}
17
- resp.body.should == 'body'
14
+ expect(resp.status).to eq 200
15
+ expect(resp.headers).to eq({'Header' => 'foo'})
16
+ expect(resp.body).to eq 'body'
18
17
  end
19
18
  end
20
19
  end
@@ -1,10 +1,10 @@
1
1
  require File.dirname(__FILE__) + "/spec_helper"
2
2
 
3
3
  describe YARD::Server do
4
- describe '.register_static_path' do
5
- it "should register a static path" do
4
+ describe ".register_static_path" do
5
+ it "registers a static path" do
6
6
  YARD::Server.register_static_path 'foo'
7
- YARD::Server::Commands::StaticFileCommand::STATIC_PATHS.last.should == "foo"
7
+ expect(YARD::Server::Commands::StaticFileCommand::STATIC_PATHS.last).to eq "foo"
8
8
  end
9
9
  end
10
10
  end
@@ -32,7 +32,7 @@ unless defined?(HAVE_RIPPER)
32
32
  LEGACY_PARSER = !HAVE_RIPPER
33
33
 
34
34
  class YARD::Parser::SourceParser
35
- def self.parser_type; :ruby18 end
35
+ def self.parser_type; @parser_type == :ruby ? :ruby18 : @parser_type end
36
36
  end if ENV['LEGACY']
37
37
  end
38
38
 
@@ -101,7 +101,7 @@ def docspec(objname = self.class.description, klass = self.class.described_type)
101
101
  exs.text.split(/\n/).each do |ex|
102
102
  begin
103
103
  hash = eval("{ #{ex} }")
104
- hash.keys.first.should == hash.values.first
104
+ expect(hash.keys.first).to eq hash.values.first
105
105
  rescue => e
106
106
  raise e, "#{e.message}\nInvalid spec example in #{objname}:\n\n\t#{ex}\n"
107
107
  end
@@ -125,6 +125,15 @@ end if ENV['TM_APP_PATH']
125
125
 
126
126
  RSpec.configure do |config|
127
127
  config.before(:each) { log.io = StringIO.new }
128
+
129
+ # isolate environment of each test
130
+ # any other global settings which might be modified by a test should also
131
+ # be saved and restored here
132
+ config.around(:each) do |example|
133
+ saved_level = log.level
134
+ example.run
135
+ log.level = saved_level
136
+ end
128
137
  end
129
138
 
130
139
  include YARD
@@ -3,155 +3,155 @@ require File.dirname(__FILE__) + '/../spec_helper'
3
3
  describe YARD::Tags::DefaultFactory do
4
4
  before { @f = YARD::Tags::DefaultFactory.new }
5
5
 
6
- describe '#parse_tag' do
7
- it "should not have trailing whitespace on a regular freeform tag" do
8
- @f.parse_tag('api', 'private ').text.should == "private"
6
+ describe "#parse_tag" do
7
+ it "does not have trailing whitespace on a regular freeform tag" do
8
+ expect(@f.parse_tag('api', 'private ').text).to eq "private"
9
9
  end
10
10
  end
11
11
 
12
- describe '#extract_types_and_name_from_text' do
12
+ describe "#extract_types_and_name_from_text" do
13
13
  def parse_types(types)
14
14
  @f.send(:extract_types_and_name_from_text, types)
15
15
  end
16
16
 
17
- it "should handle one type" do
18
- parse_types('[A]').should == [nil, ['A'], ""]
17
+ it "handles one type" do
18
+ expect(parse_types('[A]')).to eq [nil, ['A'], ""]
19
19
  end
20
20
 
21
- it "should handle a list of types" do
22
- parse_types('[A, B, C]').should == [nil, ['A', 'B', 'C'], ""]
21
+ it "handles a list of types" do
22
+ expect(parse_types('[A, B, C]')).to eq [nil, ['A', 'B', 'C'], ""]
23
23
  end
24
24
 
25
- it "should handle ducktypes" do
26
- parse_types('[#foo]').should == [nil, ['#foo'], '']
25
+ it "handles ducktypes" do
26
+ expect(parse_types('[#foo]')).to eq [nil, ['#foo'], '']
27
27
  end
28
28
 
29
29
  %w(#foo= #<< #<=> #>> #== #=== Array<#<=>> Array<#==>).each do |meth|
30
- it "should handle ducktypes with special method name #{meth}" do
31
- parse_types("[#{meth}]").should == [nil, [meth], '']
30
+ it "handles ducktypes with special method name #{meth}" do
31
+ expect(parse_types("[#{meth}]")).to eq [nil, [meth], '']
32
32
  end
33
33
  end
34
34
 
35
- it "should only parse #ducktypes inside brackets" do
36
- parse_types("#ducktype").should == [nil, nil, '#ducktype']
35
+ it "only parses #ducktypes inside brackets" do
36
+ expect(parse_types("#ducktype")).to eq [nil, nil, '#ducktype']
37
37
  end
38
38
 
39
- it "should return the text before and after the type list" do
40
- parse_types(' b <String> description').should == ['b', ['String'], 'description']
41
- parse_types('b c <String> description (test)').should == [nil, nil, 'b c <String> description (test)']
39
+ it "returns the text before and after the type list" do
40
+ expect(parse_types(' b <String> description')).to eq ['b', ['String'], 'description']
41
+ expect(parse_types('b c <String> description (test)')).to eq [nil, nil, 'b c <String> description (test)']
42
42
  end
43
43
 
44
- it "should handle a complex list of types" do
44
+ it "handles a complex list of types" do
45
45
  v = parse_types(' [Test, Array<String, Hash, C>, String]')
46
- v.should include(["Test", "Array<String, Hash, C>", "String"])
46
+ expect(v).to include(["Test", "Array<String, Hash, C>", "String"])
47
47
  end
48
48
 
49
- it "should handle any of the following start/end delimiting chars: (), <>, {}, []" do
49
+ it "handles any of the following start/end delimiting chars: (), <>, {}, []" do
50
50
  a = parse_types('[a,b,c]')
51
51
  b = parse_types('<a,b,c>')
52
52
  c = parse_types('(a,b,c)')
53
53
  d = parse_types('{a,b,c}')
54
- a.should == b
55
- b.should == c
56
- c.should == d
57
- a.should include(['a','b','c'])
54
+ expect(a).to eq b
55
+ expect(b).to eq c
56
+ expect(c).to eq d
57
+ expect(a).to include(['a','b','c'])
58
58
  end
59
59
 
60
- it "should return the text before the type list as the last element" do
61
- parse_types('b[x, y, z]').should == ['b', ['x', 'y', 'z'], '']
62
- parse_types(' ! <x>').should == ["!", ['x'], '']
60
+ it "returns the text before the type list as the last element" do
61
+ expect(parse_types('b[x, y, z]')).to eq ['b', ['x', 'y', 'z'], '']
62
+ expect(parse_types(' ! <x>')).to eq ["!", ['x'], '']
63
63
  end
64
64
 
65
- it "should return text unparsed if there is no type list" do
66
- parse_types('').should == [nil, nil, '']
67
- parse_types('[]').should == [nil, nil, '[]']
65
+ it "returns text unparsed if there is no type list" do
66
+ expect(parse_types('')).to eq [nil, nil, '']
67
+ expect(parse_types('[]')).to eq [nil, nil, '[]']
68
68
  end
69
69
 
70
- it "should allow A => B syntax" do
70
+ it "allows A => B syntax" do
71
71
  v = parse_types(' [Test, Array<String, Hash{A => {B => C}}, C>, String]')
72
- v.should include(["Test", "Array<String, Hash{A => {B => C}}, C>", "String"])
72
+ expect(v).to include(["Test", "Array<String, Hash{A => {B => C}}, C>", "String"])
73
73
  end
74
74
 
75
- it "should handle quoted values" do
75
+ it "handles quoted values" do
76
76
  v = parse_types(' ["foo, bar", \'baz, qux\', in"them,iddle"]')
77
- v.should include(["\"foo, bar\"", "'baz, qux'", 'in"them,iddle"'])
77
+ expect(v).to include(["\"foo, bar\"", "'baz, qux'", 'in"them,iddle"'])
78
78
  end
79
79
  end
80
80
 
81
- describe '#parse_tag_with_types' do
81
+ describe "#parse_tag_with_types" do
82
82
  def parse_types(text)
83
83
  @f.send(:parse_tag_with_types, 'test', text)
84
84
  end
85
85
 
86
- it "should parse given types and description" do
87
- YARD::Tags::Tag.should_receive(:new).with("test", "description", ["x", "y", "z"])
86
+ it "parses given types and description" do
87
+ expect(YARD::Tags::Tag).to receive(:new).with("test", "description", ["x", "y", "z"])
88
88
  parse_types(' [x, y, z] description')
89
89
  end
90
90
 
91
- it "should parse given types only" do
92
- YARD::Tags::Tag.should_receive(:new).with("test", "", ["x", "y", "z"])
91
+ it "parses given types only" do
92
+ expect(YARD::Tags::Tag).to receive(:new).with("test", "", ["x", "y", "z"])
93
93
  parse_types(' [x, y, z] ')
94
94
  end
95
95
 
96
- it "should allow type list to be omitted" do
97
- YARD::Tags::Tag.should_receive(:new).with('test', 'description', nil)
96
+ it "allows type list to be omitted" do
97
+ expect(YARD::Tags::Tag).to receive(:new).with('test', 'description', nil)
98
98
  parse_types(' description ')
99
99
  end
100
100
 
101
- it "should raise an error if a name is specified before type list" do
102
- lambda { parse_types('b<String> desc') }.should raise_error(YARD::Tags::TagFormatError, 'cannot specify a name before type list for \'@test\'')
101
+ it "raises an error if a name is specified before type list" do
102
+ expect { parse_types('b<String> desc') }.to raise_error(YARD::Tags::TagFormatError, 'cannot specify a name before type list for \'@test\'')
103
103
  end
104
104
  end
105
105
 
106
- describe '#parse_tag_with_types_name_and_default' do
106
+ describe "#parse_tag_with_types_name_and_default" do
107
107
  def parse_types(text)
108
108
  @f.send(:parse_tag_with_types_name_and_default, 'test', text)
109
109
  end
110
110
 
111
- it "should parse a standard type list with name before types (no default)" do
112
- YARD::Tags::DefaultTag.should_receive(:new).with("test", "description", ["x", "y", "z"], 'NAME', nil)
111
+ it "parses a standard type list with name before types (no default)" do
112
+ expect(YARD::Tags::DefaultTag).to receive(:new).with("test", "description", ["x", "y", "z"], 'NAME', nil)
113
113
  parse_types('NAME [x, y, z] description')
114
114
  end
115
115
 
116
- it "should parse a standard type list with name after types (no default)" do
117
- YARD::Tags::DefaultTag.should_receive(:new).with("test", "description", ["x", "y", "z"], 'NAME', nil)
116
+ it "parses a standard type list with name after types (no default)" do
117
+ expect(YARD::Tags::DefaultTag).to receive(:new).with("test", "description", ["x", "y", "z"], 'NAME', nil)
118
118
  parse_types(' [x, y, z] NAME description')
119
119
  end
120
120
 
121
- it "should parse a tag definition with name, typelist and default" do
122
- YARD::Tags::DefaultTag.should_receive(:new).with("test", "description", ["x", "y", "z"], 'NAME', ['default', 'values'])
121
+ it "parses a tag definition with name, typelist and default" do
122
+ expect(YARD::Tags::DefaultTag).to receive(:new).with("test", "description", ["x", "y", "z"], 'NAME', ['default', 'values'])
123
123
  parse_types(' [x, y, z] NAME (default, values) description')
124
124
  end
125
125
 
126
- it "should parse a tag definition with name, typelist and default when name is before type list" do
127
- YARD::Tags::DefaultTag.should_receive(:new).with("test", "description", ["x", "y", "z"], 'NAME', ['default', 'values'])
126
+ it "parses a tag definition with name, typelist and default when name is before type list" do
127
+ expect(YARD::Tags::DefaultTag).to receive(:new).with("test", "description", ["x", "y", "z"], 'NAME', ['default', 'values'])
128
128
  parse_types(' NAME [x, y, z] (default, values) description')
129
129
  end
130
130
 
131
- it "should allow typelist to be omitted" do
132
- YARD::Tags::DefaultTag.should_receive(:new).with("test", "description", nil, 'NAME', ['default', 'values'])
131
+ it "allows typelist to be omitted" do
132
+ expect(YARD::Tags::DefaultTag).to receive(:new).with("test", "description", nil, 'NAME', ['default', 'values'])
133
133
  parse_types(' NAME (default, values) description')
134
134
  end
135
135
  end
136
136
 
137
- describe '#parse_tag_with_options' do
137
+ describe "#parse_tag_with_options" do
138
138
  def parse_options(text)
139
139
  @f.parse_tag_with_options('option', text)
140
140
  end
141
141
 
142
- it "should have a name before tag info" do
142
+ it "has a name before tag info" do
143
143
  t = parse_options("xyz key [Types] (default) description")
144
- t.tag_name.should == 'option'
145
- t.name.should == 'xyz'
144
+ expect(t.tag_name).to eq 'option'
145
+ expect(t.name).to eq 'xyz'
146
146
  end
147
147
 
148
- it "should parse the rest of the tag like DefaultTag" do
148
+ it "parses the rest of the tag like DefaultTag" do
149
149
  t = parse_options("xyz key [Types] (default) description")
150
- t.pair.should be_instance_of(Tags::DefaultTag)
151
- t.pair.types.should == ["Types"]
152
- t.pair.name.should == "key"
153
- t.pair.defaults.should == ["default"]
154
- t.pair.text.should == "description"
150
+ expect(t.pair).to be_instance_of(Tags::DefaultTag)
151
+ expect(t.pair.types).to eq ["Types"]
152
+ expect(t.pair.name).to eq "key"
153
+ expect(t.pair.defaults).to eq ["default"]
154
+ expect(t.pair.text).to eq "description"
155
155
  end
156
156
  end
157
157
  end
@@ -1,11 +1,11 @@
1
1
  require File.dirname(__FILE__) + '/../spec_helper'
2
2
 
3
3
  describe YARD::Tags::DefaultTag do
4
- it "should create a tag with defaults" do
4
+ it "creates a tag with defaults" do
5
5
  o = YARD::Tags::DefaultTag.new('tagname', 'desc', ['types'], 'name', ['defaults'])
6
- o.defaults.should == ['defaults']
7
- o.tag_name.should == 'tagname'
8
- o.name.should == 'name'
9
- o.types.should == ['types']
6
+ expect(o.defaults).to eq ['defaults']
7
+ expect(o.tag_name).to eq 'tagname'
8
+ expect(o.name).to eq 'name'
9
+ expect(o.types).to eq ['types']
10
10
  end
11
11
  end
@@ -7,28 +7,28 @@ def tag_parse(content, object = nil, handler = nil)
7
7
  end
8
8
 
9
9
  describe YARD::Tags::ParseDirective do
10
- describe '#call' do
10
+ describe "#call" do
11
11
  after { Registry.clear }
12
12
 
13
- it "should parse if handler=nil but use file=(stdin)" do
13
+ it "parses if handler=nil but use file=(stdin)" do
14
14
  tag_parse %{@!parse
15
15
  # Docstring here
16
16
  def foo; end
17
17
  }
18
- Registry.at('#foo').docstring.should == "Docstring here"
19
- Registry.at('#foo').file.should == '(stdin)'
18
+ expect(Registry.at('#foo').docstring).to eq "Docstring here"
19
+ expect(Registry.at('#foo').file).to eq '(stdin)'
20
20
  end
21
21
 
22
- it "should allow parser type to be specified in type" do
22
+ it "allows parser type to be specified in type" do
23
23
  tag_parse %{@!parse [c]
24
24
  void Init_Foo() {
25
25
  rb_define_method(rb_cMyClass, "foo", foo, 1);
26
26
  }
27
27
  }
28
- Registry.at('MyClass#foo').should_not be_nil
28
+ expect(Registry.at('MyClass#foo')).not_to be nil
29
29
  end
30
30
 
31
- it "should parse code in context of current handler" do
31
+ it "parses code in context of current handler" do
32
32
  src = <<-eof
33
33
  class A
34
34
  # @!parse
@@ -39,35 +39,35 @@ describe YARD::Tags::ParseDirective do
39
39
  parser = Parser::SourceParser.new
40
40
  parser.file = "myfile.rb"
41
41
  parser.parse(StringIO.new(src))
42
- Registry.at('A#foo').file.should == 'myfile.rb'
42
+ expect(Registry.at('A#foo').file).to eq 'myfile.rb'
43
43
  end
44
44
  end
45
45
  end
46
46
 
47
47
  describe YARD::Tags::GroupDirective do
48
- describe '#call' do
49
- it "should do nothing if handler=nil" do
48
+ describe "#call" do
49
+ it "does nothing if handler=nil" do
50
50
  tag_parse("@!group foo")
51
51
  end
52
52
 
53
- it "should set group value in parser state (with handler)" do
53
+ it "sets group value in parser state (with handler)" do
54
54
  handler = OpenStruct.new(:extra_state => OpenStruct.new)
55
55
  tag_parse("@!group foo", nil, handler)
56
- handler.extra_state.group.should == 'foo'
56
+ expect(handler.extra_state.group).to eq 'foo'
57
57
  end
58
58
  end
59
59
  end
60
60
 
61
61
  describe YARD::Tags::EndGroupDirective do
62
- describe '#call' do
63
- it "should do nothing if handler=nil" do
62
+ describe "#call" do
63
+ it "does nothing if handler=nil" do
64
64
  tag_parse("@!endgroup foo")
65
65
  end
66
66
 
67
- it "should set group value in parser state (with handler)" do
67
+ it "sets group value in parser state (with handler)" do
68
68
  handler = OpenStruct.new(:extra_state => OpenStruct.new(:group => "foo"))
69
69
  tag_parse("@!endgroup", nil, handler)
70
- handler.extra_state.group.should be_nil
70
+ expect(handler.extra_state.group).to be nil
71
71
  end
72
72
  end
73
73
  end
@@ -83,79 +83,79 @@ describe YARD::Tags::MacroDirective do
83
83
 
84
84
  after(:all) { Registry.clear }
85
85
 
86
- describe '#call' do
87
- it "should define new macro when [new] is provided" do
86
+ describe "#call" do
87
+ it "defines new macro when [new] is provided" do
88
88
  tag_parse("@!macro [new] foo\n foo")
89
- CodeObjects::MacroObject.find('foo').macro_data.should == 'foo'
89
+ expect(CodeObjects::MacroObject.find('foo').macro_data).to eq 'foo'
90
90
  end
91
91
 
92
- it "should define new macro if text block is provided" do
92
+ it "defines new macro if text block is provided" do
93
93
  tag_parse("@!macro bar\n bar")
94
- CodeObjects::MacroObject.find('bar').macro_data.should == 'bar'
94
+ expect(CodeObjects::MacroObject.find('bar').macro_data).to eq 'bar'
95
95
  end
96
96
 
97
- it "should expand macros and return #expanded_text to tag parser" do
97
+ it "expands macros and return #expanded_text to tag parser" do
98
98
  tag_parse("@!macro [new] foo\n foo")
99
- tag_parse("@!macro foo").text.should == 'foo'
99
+ expect(tag_parse("@!macro foo").text).to eq 'foo'
100
100
  end
101
101
 
102
- it "should not expand new macro if docstring is unattached" do
103
- tag_parse("@!macro [new] foo\n foo").text.should_not == 'foo'
102
+ it "does not expand new macro if docstring is unattached" do
103
+ expect(tag_parse("@!macro [new] foo\n foo").text).not_to eq 'foo'
104
104
  end
105
105
 
106
- it "should expand new anonymous macro even if docstring is unattached" do
107
- tag_parse("@!macro\n foo").text.should == 'foo'
106
+ it "expands new anonymous macro even if docstring is unattached" do
107
+ expect(tag_parse("@!macro\n foo").text).to eq 'foo'
108
108
  end
109
109
 
110
- it "should allow multiple macros to be expanded" do
110
+ it "allows multiple macros to be expanded" do
111
111
  tag_parse("@!macro [new] foo\n foo")
112
112
  tag_parse("@!macro bar\n bar")
113
- tag_parse("@!macro foo\n@!macro bar").text.should == "foo\nbar"
113
+ expect(tag_parse("@!macro foo\n@!macro bar").text).to eq "foo\nbar"
114
114
  end
115
115
 
116
- it "should allow anonymous macros" do
116
+ it "allows anonymous macros" do
117
117
  tag_parse("@!macro\n a b c", nil, handler)
118
- @parser.text.should == 'a b c'
118
+ expect(@parser.text).to eq 'a b c'
119
119
  end
120
120
 
121
- it "should expand call_params and caller_method using $N when handler is provided" do
121
+ it "expands call_params and caller_method using $N when handler is provided" do
122
122
  tag_parse("@!macro\n $1 $2 $3", nil, handler)
123
- @parser.text.should == 'a b c'
123
+ expect(@parser.text).to eq 'a b c'
124
124
  end
125
125
 
126
- it "should attach macro to method if one exists" do
126
+ it "attaches macro to method if one exists" do
127
127
  tag_parse("@!macro [attach] attached\n $1 $2 $3", nil, handler)
128
128
  macro = CodeObjects::MacroObject.find('attached')
129
- macro.method_object.should == P('Foo::Bar.foo')
129
+ expect(macro.method_object).to eq P('Foo::Bar.foo')
130
130
  end
131
131
 
132
- it "should not expand new attached macro if defined on class method" do
132
+ it "does not expand new attached macro if defined on class method" do
133
133
  baz = CodeObjects::MethodObject.new(P('Foo::Bar'), :baz, :class)
134
- baz.visibility.should == :public
134
+ expect(baz.visibility).to eq :public
135
135
  tag_parse("@!macro [attach] attached2\n @!visibility private", baz, handler)
136
136
  macro = CodeObjects::MacroObject.find('attached2')
137
- macro.method_object.should == P('Foo::Bar.baz')
138
- baz.visibility.should == :public
137
+ expect(macro.method_object).to eq P('Foo::Bar.baz')
138
+ expect(baz.visibility).to eq :public
139
139
  end
140
140
 
141
- it "should expand macro if defined on class method and there is no data block" do
141
+ it "expands macro if defined on class method and there is no data block" do
142
142
  tag_parse("@!macro [new] attached3\n expanded_data")
143
143
  baz = CodeObjects::MethodObject.new(P('Foo::Bar'), :baz, :class)
144
144
  doc = DocstringParser.new.parse('@!macro attached3', baz, handler).to_docstring
145
- doc.should == 'expanded_data'
145
+ expect(doc).to eq 'expanded_data'
146
146
  end
147
147
 
148
- it "should not attempt to expand macro values if handler = nil" do
148
+ it "does not attempt to expand macro values if handler = nil" do
149
149
  tag_parse("@!macro [attach] xyz\n $1 $2 $3")
150
150
  end
151
151
  end
152
152
  end
153
153
 
154
154
  describe YARD::Tags::MethodDirective do
155
- describe '#call' do
155
+ describe "#call" do
156
156
  after { Registry.clear }
157
157
 
158
- it "should use entire docstring if no indented data is found" do
158
+ it "uses entire docstring if no indented data is found" do
159
159
  YARD.parse_string <<-eof
160
160
  class Foo
161
161
  # @!method foo
@@ -163,11 +163,11 @@ describe YARD::Tags::MethodDirective do
163
163
  # @!scope class
164
164
  end
165
165
  eof
166
- Registry.at('Foo.foo').should be_a(CodeObjects::MethodObject)
167
- Registry.at('Foo.bar').should be_a(CodeObjects::MethodObject)
166
+ expect(Registry.at('Foo.foo')).to be_a(CodeObjects::MethodObject)
167
+ expect(Registry.at('Foo.bar')).to be_a(CodeObjects::MethodObject)
168
168
  end
169
169
 
170
- it "should handle indented block text in @!method" do
170
+ it "handles indented block text in @!method" do
171
171
  YARD.parse_string <<-eof
172
172
  # @!method foo(a)
173
173
  # Docstring here
@@ -176,12 +176,12 @@ describe YARD::Tags::MethodDirective do
176
176
  # @param [String] a
177
177
  eof
178
178
  foo = Registry.at('#foo')
179
- foo.docstring.should == "Docstring here"
180
- foo.docstring.tag(:return).should_not be_nil
181
- foo.tag(:param).should be_nil
179
+ expect(foo.docstring).to eq "Docstring here"
180
+ expect(foo.docstring.tag(:return)).not_to be nil
181
+ expect(foo.tag(:param)).to be nil
182
182
  end
183
183
 
184
- it "should execute directives on object in indented block" do
184
+ it "executes directives on object in indented block" do
185
185
  YARD.parse_string <<-eof
186
186
  class Foo
187
187
  # @!method foo(a)
@@ -193,12 +193,12 @@ describe YARD::Tags::MethodDirective do
193
193
  end
194
194
  eof
195
195
  foo = Registry.at('Foo.foo')
196
- foo.visibility.should == :private
196
+ expect(foo.visibility).to eq :private
197
197
  bar = Registry.at('Foo#bar')
198
- bar.visibility.should == :public
198
+ expect(bar.visibility).to eq :public
199
199
  end
200
200
 
201
- it "should be able to define multiple @methods in docstring" do
201
+ it "is able to define multiple @methods in docstring" do
202
202
  YARD.parse_string <<-eof
203
203
  class Foo
204
204
  # @!method foo1
@@ -213,12 +213,12 @@ describe YARD::Tags::MethodDirective do
213
213
  foo1 = Registry.at('Foo#foo1')
214
214
  foo2 = Registry.at('Foo#foo2')
215
215
  foo3 = Registry.at('Foo.foo3')
216
- foo1.docstring.should == 'Docstring1'
217
- foo2.docstring.should == 'Docstring2'
218
- foo3.docstring.should == 'Docstring3'
216
+ expect(foo1.docstring).to eq 'Docstring1'
217
+ expect(foo2.docstring).to eq 'Docstring2'
218
+ expect(foo3.docstring).to eq 'Docstring3'
219
219
  end
220
220
 
221
- it "should define the method inside namespace if attached to namespace object" do
221
+ it "defines the method inside namespace if attached to namespace object" do
222
222
  YARD.parse_string <<-eof
223
223
  module Foo
224
224
  # @!method foo
@@ -229,11 +229,11 @@ describe YARD::Tags::MethodDirective do
229
229
  end
230
230
  end
231
231
  eof
232
- Registry.at('Foo::Bar#foo').docstring.should == 'Docstring1'
233
- Registry.at('Foo::Bar#bar').docstring.should == 'Docstring2'
232
+ expect(Registry.at('Foo::Bar#foo').docstring).to eq 'Docstring1'
233
+ expect(Registry.at('Foo::Bar#bar').docstring).to eq 'Docstring2'
234
234
  end
235
235
 
236
- it "should set scope to class if signature has 'self.' prefix" do
236
+ it "sets scope to class if signature has 'self.' prefix" do
237
237
  YARD.parse_string <<-eof
238
238
  # @!method self.foo
239
239
  # @!method self. bar
@@ -242,18 +242,18 @@ describe YARD::Tags::MethodDirective do
242
242
  end
243
243
  eof
244
244
  %w(foo bar baz).each do |name|
245
- Registry.at("Foo.#{name}").should be_a(CodeObjects::MethodObject)
245
+ expect(Registry.at("Foo.#{name}")).to be_a(CodeObjects::MethodObject)
246
246
  end
247
247
  end
248
248
 
249
- it "should define parameters from signature" do
249
+ it "defines parameters from signature" do
250
250
  YARD.parse_string <<-eof
251
251
  # @!method foo(a, b, c = nil)
252
252
  eof
253
- Registry.at('#foo').parameters.should == [['a', nil], ['b', nil], ['c', 'nil']]
253
+ expect(Registry.at('#foo').parameters).to eq [['a', nil], ['b', nil], ['c', 'nil']]
254
254
  end
255
255
 
256
- it "should be able to define method with module scope (module function)" do
256
+ it "is able to define method with module scope (module function)" do
257
257
  YARD.parse_string <<-eof
258
258
  # @!method foo
259
259
  # @!scope module
@@ -264,20 +264,20 @@ describe YARD::Tags::MethodDirective do
264
264
  eof
265
265
  foo_c = Registry.at('Foo.foo')
266
266
  foo_i = Registry.at('Foo#foo')
267
- foo_c.should_not be_nil
268
- foo_i.should_not be_nil
269
- foo_c.should be_module_function
270
- foo_c.docstring.should == foo_i.docstring
271
- foo_c.tag(:return).text.should == foo_i.tag(:return).text
267
+ expect(foo_c).not_to be nil
268
+ expect(foo_i).not_to be nil
269
+ expect(foo_c).to be_module_function
270
+ expect(foo_c.docstring).to eq foo_i.docstring
271
+ expect(foo_c.tag(:return).text).to eq foo_i.tag(:return).text
272
272
  end
273
273
  end
274
274
  end
275
275
 
276
276
  describe YARD::Tags::AttributeDirective do
277
- describe '#call' do
277
+ describe "#call" do
278
278
  after { Registry.clear }
279
279
 
280
- it "should use entire docstring if no indented data is found" do
280
+ it "uses entire docstring if no indented data is found" do
281
281
  YARD.parse_string <<-eof
282
282
  class Foo
283
283
  # @!attribute foo
@@ -285,11 +285,11 @@ describe YARD::Tags::AttributeDirective do
285
285
  # @!scope class
286
286
  end
287
287
  eof
288
- Registry.at('Foo.foo').should be_reader
289
- Registry.at('Foo.bar').should be_reader
288
+ expect(Registry.at('Foo.foo')).to be_reader
289
+ expect(Registry.at('Foo.bar')).to be_reader
290
290
  end
291
291
 
292
- it "should handle indented block in @!attribute" do
292
+ it "handles indented block in @!attribute" do
293
293
  YARD.parse_string <<-eof
294
294
  # @!attribute foo
295
295
  # Docstring here
@@ -298,13 +298,13 @@ describe YARD::Tags::AttributeDirective do
298
298
  # @param [String] a
299
299
  eof
300
300
  foo = Registry.at('#foo')
301
- foo.is_attribute?.should == true
302
- foo.docstring.should == "Docstring here"
303
- foo.docstring.tag(:return).should_not be_nil
304
- foo.tag(:param).should be_nil
301
+ expect(foo.is_attribute?).to be true
302
+ expect(foo.docstring).to eq "Docstring here"
303
+ expect(foo.docstring.tag(:return)).not_to be nil
304
+ expect(foo.tag(:param)).to be nil
305
305
  end
306
306
 
307
- it "should be able to define multiple @attributes in docstring" do
307
+ it "is able to define multiple @attributes in docstring" do
308
308
  YARD.parse_string <<-eof
309
309
  class Foo
310
310
  # @!attribute [r] foo1
@@ -320,18 +320,18 @@ describe YARD::Tags::AttributeDirective do
320
320
  foo2 = Registry.at('Foo#foo2=')
321
321
  foo3 = Registry.at('Foo.foo3')
322
322
  foo4 = Registry.at('Foo.foo3=')
323
- foo1.should be_reader
324
- foo2.should be_writer
325
- foo3.should be_reader
326
- foo1.docstring.should == 'Docstring1'
327
- foo2.docstring.should == 'Docstring2'
328
- foo3.docstring.should == 'Docstring3'
329
- foo4.should be_writer
330
- foo1.attr_info[:write].should be_nil
331
- foo2.attr_info[:read].should be_nil
332
- end
333
-
334
- it "should define the attr inside namespace if attached to namespace object" do
323
+ expect(foo1).to be_reader
324
+ expect(foo2).to be_writer
325
+ expect(foo3).to be_reader
326
+ expect(foo1.docstring).to eq 'Docstring1'
327
+ expect(foo2.docstring).to eq 'Docstring2'
328
+ expect(foo3.docstring).to eq 'Docstring3'
329
+ expect(foo4).to be_writer
330
+ expect(foo1.attr_info[:write]).to be nil
331
+ expect(foo2.attr_info[:read]).to be nil
332
+ end
333
+
334
+ it "defines the attr inside namespace if attached to namespace object" do
335
335
  YARD.parse_string <<-eof
336
336
  module Foo
337
337
  # @!attribute [r] foo
@@ -340,12 +340,12 @@ describe YARD::Tags::AttributeDirective do
340
340
  end
341
341
  end
342
342
  eof
343
- Registry.at('Foo::Bar#foo').should be_reader
344
- Registry.at('Foo::Bar#bar').should be_reader
343
+ expect(Registry.at('Foo::Bar#foo')).to be_reader
344
+ expect(Registry.at('Foo::Bar#bar')).to be_reader
345
345
  end
346
346
  end
347
347
 
348
- it "should set scope to class if signature has 'self.' prefix" do
348
+ it "sets scope to class if signature has 'self.' prefix" do
349
349
  YARD.parse_string <<-eof
350
350
  # @!attribute self.foo
351
351
  # @!attribute self. bar
@@ -354,82 +354,82 @@ describe YARD::Tags::AttributeDirective do
354
354
  end
355
355
  eof
356
356
  %w(foo bar baz).each do |name|
357
- Registry.at("Foo.#{name}").should be_reader
357
+ expect(Registry.at("Foo.#{name}")).to be_reader
358
358
  end
359
359
  end
360
360
  end
361
361
 
362
362
  describe YARD::Tags::ScopeDirective do
363
- describe '#call' do
363
+ describe "#call" do
364
364
  after { Registry.clear }
365
365
 
366
- it "should set state on tag parser if object = nil" do
366
+ it "sets state on tag parser if object = nil" do
367
367
  tag_parse("@!scope class")
368
- @parser.state.scope.should == :class
368
+ expect(@parser.state.scope).to eq :class
369
369
  end
370
370
 
371
- it "should set state on tag parser if object is namespace" do
371
+ it "sets state on tag parser if object is namespace" do
372
372
  object = CodeObjects::ClassObject.new(:root, 'Foo')
373
373
  tag_parse("@!scope class", object)
374
- object[:scope].should be_nil
375
- @parser.state.scope.should == :class
374
+ expect(object[:scope]).to be nil
375
+ expect(@parser.state.scope).to eq :class
376
376
  end
377
377
 
378
- it "should set scope on object if object is a method object" do
378
+ it "sets scope on object if object is a method object" do
379
379
  object = CodeObjects::MethodObject.new(:root, 'foo')
380
380
  tag_parse("@!scope class", object)
381
- object.scope.should == :class
381
+ expect(object.scope).to eq :class
382
382
  end
383
383
 
384
384
  %w(class instance module).each do |type|
385
- it "should allow #{type} as value" do
385
+ it "allows #{type} as value" do
386
386
  tag_parse("@!scope #{type}")
387
- @parser.state.scope.should == type.to_sym
387
+ expect(@parser.state.scope).to eq type.to_sym
388
388
  end
389
389
  end
390
390
 
391
391
  %w(invalid foo FOO CLASS INSTANCE).each do |type|
392
- it "should not allow #{type} as value" do
392
+ it "does not allow #{type} as value" do
393
393
  tag_parse("@!scope #{type}")
394
- @parser.state.scope.should be_nil
394
+ expect(@parser.state.scope).to be nil
395
395
  end
396
396
  end
397
397
  end
398
398
  end
399
399
 
400
400
  describe YARD::Tags::VisibilityDirective do
401
- describe '#call' do
401
+ describe "#call" do
402
402
  after { Registry.clear }
403
403
 
404
- it "should set visibility on tag parser if object = nil" do
404
+ it "sets visibility on tag parser if object = nil" do
405
405
  tag_parse("@!visibility private")
406
- @parser.state.visibility.should == :private
406
+ expect(@parser.state.visibility).to eq :private
407
407
  end
408
408
 
409
- it "should set state on tag parser if object is namespace" do
409
+ it "sets state on tag parser if object is namespace" do
410
410
  object = CodeObjects::ClassObject.new(:root, 'Foo')
411
411
  tag_parse("@!visibility protected", object)
412
- object.visibility.should == :protected
413
- @parser.state.visibility.should be_nil
412
+ expect(object.visibility).to eq :protected
413
+ expect(@parser.state.visibility).to be nil
414
414
  end
415
415
 
416
- it "should set visibility on object if object is a method object" do
416
+ it "sets visibility on object if object is a method object" do
417
417
  object = CodeObjects::MethodObject.new(:root, 'foo')
418
418
  tag_parse("@!visibility private", object)
419
- object.visibility.should == :private
419
+ expect(object.visibility).to eq :private
420
420
  end
421
421
 
422
422
  %w(public private protected).each do |type|
423
- it "should allow #{type} as value" do
423
+ it "allows #{type} as value" do
424
424
  tag_parse("@!visibility #{type}")
425
- @parser.state.visibility.should == type.to_sym
425
+ expect(@parser.state.visibility).to eq type.to_sym
426
426
  end
427
427
  end
428
428
 
429
429
  %w(invalid foo FOO PRIVATE INSTANCE).each do |type|
430
- it "should not allow #{type} as value" do
430
+ it "does not allow #{type} as value" do
431
431
  tag_parse("@!visibility #{type}")
432
- @parser.state.visibility.should be_nil
432
+ expect(@parser.state.visibility).to be nil
433
433
  end
434
434
  end
435
435
 
@@ -446,7 +446,7 @@ describe YARD::Tags::VisibilityDirective do
446
446
  end
447
447
  eof
448
448
  %w(foo bar baz).each do |name|
449
- Registry.at("Foo##{name}").visibility.should == :private
449
+ expect(Registry.at("Foo##{name}").visibility).to eq :private
450
450
  end
451
451
  end if YARD::Parser::SourceParser.parser_type == :ruby
452
452
  end