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
@@ -10,15 +10,15 @@ describe YARD::I18n::Locale do
10
10
  end
11
11
 
12
12
  describe "#name" do
13
- it "should return name" do
14
- locale("fr").name.should == "fr"
13
+ it "returns name" do
14
+ expect(locale("fr").name).to eq "fr"
15
15
  end
16
16
  end
17
17
 
18
18
  describe "#load" do
19
- it "should return false for nonexistent PO" do
20
- File.should_receive(:exist?).with('foo/fr.po').and_return(false)
21
- @locale.load('foo').should == false
19
+ it "returns false for nonexistent PO" do
20
+ expect(File).to receive(:exist?).with('foo/fr.po').and_return(false)
21
+ expect(@locale.load('foo')).to be false
22
22
  end
23
23
 
24
24
  have_gettext_gem = true
@@ -40,7 +40,7 @@ describe YARD::I18n::Locale do
40
40
  end
41
41
  end
42
42
 
43
- it "should return true for existent PO", :if => have_gettext_gem do
43
+ it "returns true for existent PO", :if => have_gettext_gem do
44
44
  data = <<-eop
45
45
  msgid ""
46
46
  msgstr ""
@@ -53,14 +53,14 @@ msgid "Hello"
53
53
  msgstr "Bonjour"
54
54
  eop
55
55
  parser = GetText::POParser.new
56
- File.should_receive(:exist?).with('foo/fr.po').and_return(true)
57
- GetText::POParser.should_receive(:new).and_return(parser)
58
- parser.should_receive(:parse_file) do |file, hash|
59
- file.should == 'foo/fr.po'
56
+ expect(File).to receive(:exist?).with('foo/fr.po').and_return(true)
57
+ expect(GetText::POParser).to receive(:new).and_return(parser)
58
+ expect(parser).to receive(:parse_file) do |file, hash|
59
+ expect(file).to eq 'foo/fr.po'
60
60
  parser.parse(data, hash)
61
61
  end
62
- @locale.load('foo').should == true
63
- @locale.translate('Hello').should == "Bonjour"
62
+ expect(@locale.load('foo')).to be true
63
+ expect(@locale.translate('Hello')).to eq "Bonjour"
64
64
  end
65
65
  end
66
66
 
@@ -70,12 +70,12 @@ eop
70
70
  messages["Hello"] = "Bonjour"
71
71
  end
72
72
 
73
- it "should return translated string for existent string" do
74
- @locale.translate("Hello") == "Bonjour"
73
+ it "returns translated string for existent string" do
74
+ expect(@locale.translate("Hello")) == "Bonjour"
75
75
  end
76
76
 
77
- it "should return original string for nonexistent string" do
78
- @locale.translate("nonexistent") == "nonexistent"
77
+ it "returns original string for nonexistent string" do
78
+ expect(@locale.translate("nonexistent")) == "nonexistent"
79
79
  end
80
80
  end
81
81
  end
@@ -10,29 +10,29 @@ describe YARD::I18n::Message do
10
10
  end
11
11
 
12
12
  describe "#id" do
13
- it "should return ID" do
14
- message("Hello World!").id.should == "Hello World!"
13
+ it "returns ID" do
14
+ expect(message("Hello World!").id).to eq "Hello World!"
15
15
  end
16
16
  end
17
17
 
18
18
  describe "#add_location" do
19
- it "should add some locations" do
19
+ it "adds some locations" do
20
20
  @message.add_location("hello.rb", 10)
21
21
  @message.add_location("message.rb", 5)
22
- @message.locations.should == Set.new([["hello.rb", 10], ["message.rb", 5]])
22
+ expect(@message.locations).to eq Set.new([["hello.rb", 10], ["message.rb", 5]])
23
23
  end
24
24
  end
25
25
 
26
26
  describe "#add_comment" do
27
- it "should add some comments" do
27
+ it "adds some comments" do
28
28
  @message.add_comment("YARD.title")
29
29
  @message.add_comment("Hello#message")
30
- @message.comments.should == Set.new(["YARD.title", "Hello#message"])
30
+ expect(@message.comments).to eq Set.new(["YARD.title", "Hello#message"])
31
31
  end
32
32
  end
33
33
 
34
34
  describe "#==" do
35
- it "should return true for same value messages" do
35
+ it "returns true for same value messages" do
36
36
  locations = [["hello.rb", 10], ["message.rb", 5]]
37
37
  comments = ["YARD.title", "Hello#message"]
38
38
 
@@ -46,7 +46,7 @@ describe YARD::I18n::Message do
46
46
  other_message.add_comment(comment)
47
47
  end
48
48
 
49
- @message.should == other_message
49
+ expect(@message).to eq other_message
50
50
  end
51
51
  end
52
52
  end
@@ -14,7 +14,7 @@ describe YARD::I18n::Messages do
14
14
  end
15
15
 
16
16
  describe "#each" do
17
- it "should enumerate Message" do
17
+ it "enumerates messages" do
18
18
  @messages.register("Hello World!")
19
19
  @messages.register("Title")
20
20
  enumerated_messages = []
@@ -22,46 +22,46 @@ describe YARD::I18n::Messages do
22
22
  enumerated_messages << message
23
23
  end
24
24
  enumerated_messages = enumerated_messages.sort_by {|m| m.id }
25
- enumerated_messages.should == [message("Hello World!"), message("Title")]
25
+ expect(enumerated_messages).to eq [message("Hello World!"), message("Title")]
26
26
  end
27
27
 
28
- it "should not any Message for empty messages" do
28
+ it "does not yield any message if there are none" do
29
29
  enumerated_messages = []
30
30
  @messages.each do |message|
31
31
  enumerated_messages << message
32
32
  end
33
- enumerated_messages.should == []
33
+ expect(enumerated_messages).to eq []
34
34
  end
35
35
  end
36
36
 
37
37
  describe "#[]" do
38
- it "should return registered message" do
38
+ it "returns registered message" do
39
39
  @messages.register("Hello World!")
40
- @messages["Hello World!"].should == message("Hello World!")
40
+ expect(@messages["Hello World!"]).to eq message("Hello World!")
41
41
  end
42
42
 
43
- it "should return for nonexistent message ID" do
44
- @messages["Hello World!"].should == nil
43
+ it "returns nil for nonexistent message ID" do
44
+ expect(@messages["Hello World!"]).to eq nil
45
45
  end
46
46
  end
47
47
 
48
48
  describe "#register" do
49
- it "should return registered message" do
50
- @messages.register("Hello World!").should == message("Hello World!")
49
+ it "returns registered message" do
50
+ expect(@messages.register("Hello World!")).to eq message("Hello World!")
51
51
  end
52
52
 
53
- it "should return existent message" do
53
+ it "returns existent message" do
54
54
  message = @messages.register("Hello World!")
55
- @messages.register("Hello World!").object_id.should == message.object_id
55
+ expect(@messages.register("Hello World!").object_id).to eq message.object_id
56
56
  end
57
57
  end
58
58
 
59
59
  describe "#==" do
60
- it "should return true for same value messages" do
60
+ it "returns true for same value messages" do
61
61
  @messages.register("Hello World!")
62
62
  other_messages = messages
63
63
  other_messages.register("Hello World!")
64
- @messages.should == other_messages
64
+ expect(@messages).to eq other_messages
65
65
  end
66
66
  end
67
67
  end
@@ -24,11 +24,11 @@ describe YARD::I18n::PotGenerator do
24
24
  end
25
25
 
26
26
  describe "Generate" do
27
- it "should generate the default header" do
27
+ it "generates the default header" do
28
28
  current_time = Time.parse("2011-11-20 22:17+0900")
29
- @generator.stub!(:current_time).and_return(current_time)
29
+ allow(@generator).to receive(:current_time).and_return(current_time)
30
30
  pot_creation_date = current_time.strftime("%Y-%m-%d %H:%M%z")
31
- @generator.generate.should == <<-eoh
31
+ expect(@generator.generate).to eq <<-eoh
32
32
  # SOME DESCRIPTIVE TITLE.
33
33
  # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
34
34
  # This file is distributed under the same license as the PACKAGE package.
@@ -51,8 +51,8 @@ msgstr ""
51
51
  eoh
52
52
  end
53
53
 
54
- it "should generate messages in location order" do
55
- @generator.stub!(:header).and_return("HEADER\n\n")
54
+ it "generates messages in location order" do
55
+ allow(@generator).to receive(:header).and_return("HEADER\n\n")
56
56
  messages = {
57
57
  "tag|see|Parser::SourceParser.parse" => {
58
58
  :locations => [["yard.rb", 14]],
@@ -64,7 +64,7 @@ eoh
64
64
  }
65
65
  }
66
66
  add_messages(@generator.messages, messages)
67
- @generator.generate.should == <<-'eoh'
67
+ expect(@generator.generate).to eq <<-'eoh'
68
68
  HEADER
69
69
 
70
70
  # YARD.parse
@@ -91,24 +91,24 @@ eoh
91
91
  pot
92
92
  end
93
93
 
94
- it "should escape <\\>" do
95
- generate_message_pot("hello \\ world").should == <<-'eop'
94
+ it "escapes <\\>" do
95
+ expect(generate_message_pot("hello \\ world")).to eq <<-'eop'
96
96
  msgid "hello \\ world"
97
97
  msgstr ""
98
98
 
99
99
  eop
100
100
  end
101
101
 
102
- it "should escape <\">" do
103
- generate_message_pot("hello \" world").should == <<-'eop'
102
+ it "escapes <\">" do
103
+ expect(generate_message_pot("hello \" world")).to eq <<-'eop'
104
104
  msgid "hello \" world"
105
105
  msgstr ""
106
106
 
107
107
  eop
108
108
  end
109
109
 
110
- it "should escape <\\n>" do
111
- generate_message_pot("hello \n world").should == <<-'eop'
110
+ it "escapes <\\n>" do
111
+ expect(generate_message_pot("hello \n world")).to eq <<-'eop'
112
112
  msgid "hello \n"
113
113
  " world"
114
114
  msgstr ""
@@ -123,12 +123,12 @@ eop
123
123
  @yard = YARD::CodeObjects::ModuleObject.new(:root, :YARD)
124
124
  end
125
125
 
126
- it "should extract docstring" do
126
+ it "extracts at docstring" do
127
127
  object = YARD::CodeObjects::MethodObject.new(@yard, :parse, :module) do |o|
128
128
  o.docstring = "An alias to {Parser::SourceParser}'s parsing method"
129
129
  end
130
130
  @generator.parse_objects([object])
131
- @generator.messages.should == create_messages({
131
+ expect(@generator.messages).to eq create_messages({
132
132
  "An alias to {Parser::SourceParser}'s parsing method" => {
133
133
  :locations => [],
134
134
  :comments => ["YARD.parse"],
@@ -136,13 +136,13 @@ eop
136
136
  })
137
137
  end
138
138
 
139
- it "should extract location" do
139
+ it "extracts at location" do
140
140
  object = YARD::CodeObjects::MethodObject.new(@yard, :parse, :module) do |o|
141
141
  o.docstring = "An alias to {Parser::SourceParser}'s parsing method"
142
142
  o.files = [["yard.rb", 12]]
143
143
  end
144
144
  @generator.parse_objects([object])
145
- @generator.messages.should == create_messages({
145
+ expect(@generator.messages).to eq create_messages({
146
146
  "An alias to {Parser::SourceParser}'s parsing method" => {
147
147
  :locations => [["yard.rb", 13]],
148
148
  :comments => ["YARD.parse"],
@@ -150,13 +150,13 @@ eop
150
150
  })
151
151
  end
152
152
 
153
- it "should extract tag name" do
153
+ it "extracts at tag name" do
154
154
  object = YARD::CodeObjects::MethodObject.new(@yard, :parse, :module) do |o|
155
155
  o.docstring = "@see Parser::SourceParser.parse"
156
156
  o.files = [["yard.rb", 12]]
157
157
  end
158
158
  @generator.parse_objects([object])
159
- @generator.messages.should == create_messages({
159
+ expect(@generator.messages).to eq create_messages({
160
160
  "tag|see|Parser::SourceParser.parse" => {
161
161
  :locations => [["yard.rb", 12]],
162
162
  :comments => ["@see"],
@@ -164,7 +164,7 @@ eop
164
164
  })
165
165
  end
166
166
 
167
- it "should extract tag text" do
167
+ it "extracts at tag text" do
168
168
  object = YARD::CodeObjects::MethodObject.new(@yard, :parse, :module) do |o|
169
169
  o.docstring = <<-eod
170
170
  @example Parse a glob of files
@@ -173,7 +173,7 @@ eod
173
173
  o.files = [["yard.rb", 12]]
174
174
  end
175
175
  @generator.parse_objects([object])
176
- @generator.messages.should == create_messages({
176
+ expect(@generator.messages).to eq create_messages({
177
177
  "tag|example|Parse a glob of files" => {
178
178
  :locations => [["yard.rb", 12]],
179
179
  :comments => ["@example"],
@@ -185,7 +185,7 @@ eod
185
185
  })
186
186
  end
187
187
 
188
- it "should extract tag types" do
188
+ it "extracts at tag types" do
189
189
  object = YARD::CodeObjects::MethodObject.new(@yard, :parse, :module) do |o|
190
190
  o.docstring = <<-eod
191
191
  @param [String, Array<String>] paths a path, glob, or list of paths to
@@ -194,7 +194,7 @@ eod
194
194
  o.files = [["yard.rb", 12]]
195
195
  end
196
196
  @generator.parse_objects([object])
197
- @generator.messages.should == create_messages({
197
+ expect(@generator.messages).to eq create_messages({
198
198
  "tag|param|paths" => {
199
199
  :locations => [["yard.rb", 12]],
200
200
  :comments => ["@param [String, Array<String>]"],
@@ -206,7 +206,7 @@ eod
206
206
  })
207
207
  end
208
208
 
209
- it "should extract overload tag recursively" do
209
+ it "extracts at overload tag recursively" do
210
210
  object = YARD::CodeObjects::MethodObject.new(@yard, :parse, :module) do |o|
211
211
  o.docstring = <<-eod
212
212
  @overload foo(i)
@@ -216,7 +216,7 @@ eod
216
216
  end
217
217
 
218
218
  @generator.parse_objects([object])
219
- @generator.messages.should == create_messages({
219
+ expect(@generator.messages).to eq create_messages({
220
220
  "tag|overload|foo" => {
221
221
  :locations => [],
222
222
  :comments => ["@overload"]
@@ -238,18 +238,18 @@ eod
238
238
  end
239
239
 
240
240
  describe "File" do
241
- it "should extract attribute" do
241
+ it "extracts at attribute" do
242
242
  path = "GettingStarted.md"
243
243
  text = <<-eor
244
244
  # @title Getting Started Guide
245
245
 
246
246
  # Getting Started with YARD
247
247
  eor
248
- File.stub!(:open).with(path).and_yield(StringIO.new(text))
249
- File.stub!(:read).with(path).and_return(text)
248
+ allow(File).to receive(:open).with(path).and_yield(StringIO.new(text))
249
+ allow(File).to receive(:read).with(path).and_return(text)
250
250
  file = YARD::CodeObjects::ExtraFileObject.new(path)
251
251
  @generator.parse_files([file])
252
- @generator.messages.should == create_messages({
252
+ expect(@generator.messages).to eq create_messages({
253
253
  "Getting Started Guide" => {
254
254
  :locations => [[path, 1]],
255
255
  :comments => ["title"],
@@ -261,7 +261,7 @@ eor
261
261
  })
262
262
  end
263
263
 
264
- it "should extract paragraphs" do
264
+ it "extracts at paragraphs" do
265
265
  path = "README.md"
266
266
  paragraph1 = <<-eop.strip
267
267
  Note that class methods must not be referred to with the "::" namespace
@@ -276,11 +276,11 @@ eop
276
276
 
277
277
  #{paragraph2}
278
278
  eot
279
- File.stub!(:open).with(path).and_yield(StringIO.new(text))
280
- File.stub!(:read).with(path).and_return(text)
279
+ allow(File).to receive(:open).with(path).and_yield(StringIO.new(text))
280
+ allow(File).to receive(:read).with(path).and_return(text)
281
281
  file = YARD::CodeObjects::ExtraFileObject.new(path)
282
282
  @generator.parse_files([file])
283
- @generator.messages.should == create_messages({
283
+ expect(@generator.messages).to eq create_messages({
284
284
  paragraph1 => {
285
285
  :locations => [[path, 1]],
286
286
  :comments => [],
@@ -12,45 +12,45 @@ describe YARD::I18n::Text do
12
12
  end
13
13
 
14
14
  describe "Header" do
15
- it "should extract attribute" do
15
+ it "extracts at attribute" do
16
16
  text = <<-eot
17
17
  # @title Getting Started Guide
18
18
 
19
19
  # Getting Started with YARD
20
20
  eot
21
- extract_messages(text, :have_header => true).should ==
21
+ expect(extract_messages(text, :have_header => true)).to eq(
22
22
  [[:attribute, "title", "Getting Started Guide", 1],
23
- [:paragraph, "# Getting Started with YARD", 3]]
23
+ [:paragraph, "# Getting Started with YARD", 3]])
24
24
  end
25
25
 
26
- it "should ignore markup line" do
26
+ it "ignores markup line" do
27
27
  text = <<-eot
28
28
  #!markdown
29
29
  # @title Getting Started Guide
30
30
 
31
31
  # Getting Started with YARD
32
32
  eot
33
- extract_messages(text, :have_header => true).should ==
33
+ expect(extract_messages(text, :have_header => true)).to eq(
34
34
  [[:attribute, "title", "Getting Started Guide", 2],
35
- [:paragraph, "# Getting Started with YARD", 4]]
35
+ [:paragraph, "# Getting Started with YARD", 4]])
36
36
  end
37
37
 
38
- it "should terminate header block by markup line not at the first line" do
38
+ it "terminates header block by markup line not at the first line" do
39
39
  text = <<-eot
40
40
  # @title Getting Started Guide
41
41
  #!markdown
42
42
 
43
43
  # Getting Started with YARD
44
44
  eot
45
- extract_messages(text, :have_header => true).should ==
45
+ expect(extract_messages(text, :have_header => true)).to eq(
46
46
  [[:attribute, "title", "Getting Started Guide", 1],
47
47
  [:paragraph, "#!markdown", 2],
48
- [:paragraph, "# Getting Started with YARD", 4]]
48
+ [:paragraph, "# Getting Started with YARD", 4]])
49
49
  end
50
50
  end
51
51
 
52
52
  describe "Body" do
53
- it "should split to paragraphs" do
53
+ it "splits to paragraphs" do
54
54
  paragraph1 = <<-eop.strip
55
55
  Note that class methods must not be referred to with the "::" namespace
56
56
  separator. Only modules, classes and constants should use "::".
@@ -64,9 +64,9 @@ eop
64
64
 
65
65
  #{paragraph2}
66
66
  eot
67
- extract_messages(text).should ==
67
+ expect(extract_messages(text)).to eq(
68
68
  [[:paragraph, paragraph1, 1],
69
- [:paragraph, paragraph2, 4]]
69
+ [:paragraph, paragraph2, 4]])
70
70
  end
71
71
  end
72
72
  end
@@ -88,7 +88,7 @@ eot
88
88
  end
89
89
 
90
90
  describe "Header" do
91
- it "should extract attribute" do
91
+ it "extracts at attribute" do
92
92
  text = <<-eot
93
93
  # @title Hello
94
94
 
@@ -96,7 +96,7 @@ eot
96
96
 
97
97
  Paragraph.
98
98
  eot
99
- translate(text, :have_header => true).should == <<-eot
99
+ expect(translate(text, :have_header => true)).to eq <<-eot
100
100
  # @title Bonjour (Hello in fr)
101
101
 
102
102
  # Getting Started with YARD
@@ -105,7 +105,7 @@ Paragraph.
105
105
  eot
106
106
  end
107
107
 
108
- it "should ignore markup line" do
108
+ it "ignores markup line" do
109
109
  text = <<-eot
110
110
  #!markdown
111
111
  # @title Hello
@@ -114,7 +114,7 @@ eot
114
114
 
115
115
  Paragraph.
116
116
  eot
117
- translate(text, :have_header => true).should == <<-eot
117
+ expect(translate(text, :have_header => true)).to eq <<-eot
118
118
  #!markdown
119
119
  # @title Bonjour (Hello in fr)
120
120
 
@@ -126,7 +126,7 @@ eot
126
126
  end
127
127
 
128
128
  describe "Body" do
129
- it "should split to paragraphs" do
129
+ it "splits to paragraphs" do
130
130
  paragraph1 = <<-eop.strip
131
131
  Paragraph 1.
132
132
  eop
@@ -138,26 +138,26 @@ eop
138
138
 
139
139
  #{paragraph2}
140
140
  eot
141
- translate(text).should == <<-eot
141
+ expect(translate(text)).to eq <<-eot
142
142
  Paragraphe 1.
143
143
 
144
144
  Paragraphe 2.
145
145
  eot
146
146
  end
147
147
 
148
- it "should not modified non-translated message" do
148
+ it "does not modify non-translated message" do
149
149
  nonexistent_paragraph = <<-eop.strip
150
150
  Nonexsitent paragraph.
151
151
  eop
152
152
  text = <<-eot
153
153
  #{nonexistent_paragraph}
154
154
  eot
155
- translate(text).should == <<-eot
155
+ expect(translate(text)).to eq <<-eot
156
156
  #{nonexistent_paragraph}
157
157
  eot
158
158
  end
159
159
 
160
- it "should keep empty lines" do
160
+ it "keeps empty lines" do
161
161
  text = <<-eot
162
162
  Paragraph 1.
163
163
 
@@ -166,7 +166,7 @@ Paragraph 1.
166
166
 
167
167
  Paragraph 2.
168
168
  eot
169
- translate(text).should == <<-eot
169
+ expect(translate(text)).to eq <<-eot
170
170
  Paragraphe 1.
171
171
 
172
172