pry 0.9.12.6-i386-mswin32 → 0.10.0-i386-mswin32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +702 -0
  3. data/LICENSE +2 -2
  4. data/{README.markdown → README.md} +37 -31
  5. data/lib/pry.rb +38 -151
  6. data/lib/pry/cli.rb +35 -17
  7. data/lib/pry/code.rb +19 -63
  8. data/lib/pry/code/code_file.rb +103 -0
  9. data/lib/pry/code/code_range.rb +2 -1
  10. data/lib/pry/code/loc.rb +2 -2
  11. data/lib/pry/code_object.rb +40 -21
  12. data/lib/pry/color_printer.rb +55 -0
  13. data/lib/pry/command.rb +12 -9
  14. data/lib/pry/command_set.rb +81 -38
  15. data/lib/pry/commands.rb +1 -1
  16. data/lib/pry/commands/amend_line.rb +2 -2
  17. data/lib/pry/commands/bang.rb +1 -1
  18. data/lib/pry/commands/cat.rb +11 -2
  19. data/lib/pry/commands/cat/exception_formatter.rb +6 -7
  20. data/lib/pry/commands/cat/file_formatter.rb +15 -32
  21. data/lib/pry/commands/cat/input_expression_formatter.rb +1 -1
  22. data/lib/pry/commands/cd.rb +14 -3
  23. data/lib/pry/commands/change_inspector.rb +27 -0
  24. data/lib/pry/commands/change_prompt.rb +26 -0
  25. data/lib/pry/commands/code_collector.rb +4 -4
  26. data/lib/pry/commands/easter_eggs.rb +3 -3
  27. data/lib/pry/commands/edit.rb +10 -22
  28. data/lib/pry/commands/edit/exception_patcher.rb +2 -2
  29. data/lib/pry/commands/edit/file_and_line_locator.rb +0 -2
  30. data/lib/pry/commands/exit_program.rb +0 -1
  31. data/lib/pry/commands/find_method.rb +16 -22
  32. data/lib/pry/commands/gem_install.rb +5 -2
  33. data/lib/pry/commands/gem_open.rb +1 -1
  34. data/lib/pry/commands/gist.rb +10 -11
  35. data/lib/pry/commands/help.rb +14 -14
  36. data/lib/pry/commands/hist.rb +27 -8
  37. data/lib/pry/commands/install_command.rb +14 -12
  38. data/lib/pry/commands/list_inspectors.rb +35 -0
  39. data/lib/pry/commands/list_prompts.rb +35 -0
  40. data/lib/pry/commands/ls.rb +72 -296
  41. data/lib/pry/commands/ls/constants.rb +47 -0
  42. data/lib/pry/commands/ls/formatter.rb +49 -0
  43. data/lib/pry/commands/ls/globals.rb +48 -0
  44. data/lib/pry/commands/ls/grep.rb +21 -0
  45. data/lib/pry/commands/ls/instance_vars.rb +39 -0
  46. data/lib/pry/commands/ls/interrogatable.rb +18 -0
  47. data/lib/pry/commands/ls/jruby_hacks.rb +49 -0
  48. data/lib/pry/commands/ls/local_names.rb +35 -0
  49. data/lib/pry/commands/ls/local_vars.rb +39 -0
  50. data/lib/pry/commands/ls/ls_entity.rb +70 -0
  51. data/lib/pry/commands/ls/methods.rb +57 -0
  52. data/lib/pry/commands/ls/methods_helper.rb +46 -0
  53. data/lib/pry/commands/ls/self_methods.rb +32 -0
  54. data/lib/pry/commands/play.rb +44 -10
  55. data/lib/pry/commands/pry_backtrace.rb +1 -2
  56. data/lib/pry/commands/raise_up.rb +2 -2
  57. data/lib/pry/commands/reload_code.rb +16 -19
  58. data/lib/pry/commands/ri.rb +7 -3
  59. data/lib/pry/commands/shell_command.rb +18 -13
  60. data/lib/pry/commands/shell_mode.rb +2 -4
  61. data/lib/pry/commands/show_doc.rb +5 -0
  62. data/lib/pry/commands/show_info.rb +8 -13
  63. data/lib/pry/commands/show_source.rb +15 -3
  64. data/lib/pry/commands/simple_prompt.rb +1 -1
  65. data/lib/pry/commands/toggle_color.rb +8 -4
  66. data/lib/pry/commands/watch_expression.rb +105 -0
  67. data/lib/pry/commands/watch_expression/expression.rb +38 -0
  68. data/lib/pry/commands/whereami.rb +18 -10
  69. data/lib/pry/commands/wtf.rb +3 -3
  70. data/lib/pry/config.rb +20 -254
  71. data/lib/pry/config/behavior.rb +139 -0
  72. data/lib/pry/config/convenience.rb +26 -0
  73. data/lib/pry/config/default.rb +165 -0
  74. data/lib/pry/core_extensions.rb +31 -21
  75. data/lib/pry/editor.rb +107 -103
  76. data/lib/pry/exceptions.rb +77 -0
  77. data/lib/pry/helpers/base_helpers.rb +22 -109
  78. data/lib/pry/helpers/command_helpers.rb +10 -8
  79. data/lib/pry/helpers/documentation_helpers.rb +1 -2
  80. data/lib/pry/helpers/text.rb +4 -5
  81. data/lib/pry/history.rb +46 -45
  82. data/lib/pry/history_array.rb +6 -1
  83. data/lib/pry/hooks.rb +9 -29
  84. data/lib/pry/indent.rb +6 -6
  85. data/lib/pry/input_completer.rb +242 -0
  86. data/lib/pry/input_lock.rb +132 -0
  87. data/lib/pry/inspector.rb +27 -0
  88. data/lib/pry/last_exception.rb +61 -0
  89. data/lib/pry/method.rb +82 -87
  90. data/lib/pry/{commands/edit/method_patcher.rb → method/patcher.rb} +41 -38
  91. data/lib/pry/module_candidate.rb +4 -14
  92. data/lib/pry/object_path.rb +82 -0
  93. data/lib/pry/output.rb +50 -0
  94. data/lib/pry/pager.rb +193 -48
  95. data/lib/pry/plugins.rb +1 -1
  96. data/lib/pry/prompt.rb +26 -0
  97. data/lib/pry/pry_class.rb +149 -230
  98. data/lib/pry/pry_instance.rb +302 -413
  99. data/lib/pry/rbx_path.rb +1 -1
  100. data/lib/pry/repl.rb +202 -0
  101. data/lib/pry/repl_file_loader.rb +20 -26
  102. data/lib/pry/rubygem.rb +13 -5
  103. data/lib/pry/terminal.rb +2 -1
  104. data/lib/pry/test/helper.rb +26 -41
  105. data/lib/pry/version.rb +1 -1
  106. data/lib/pry/wrapped_module.rb +45 -59
  107. metadata +62 -225
  108. data/.document +0 -2
  109. data/.gitignore +0 -16
  110. data/.travis.yml +0 -25
  111. data/.yardopts +0 -1
  112. data/CHANGELOG +0 -534
  113. data/CONTRIBUTORS +0 -55
  114. data/Gemfile +0 -12
  115. data/Rakefile +0 -140
  116. data/TODO +0 -117
  117. data/lib/pry/completion.rb +0 -321
  118. data/lib/pry/custom_completions.rb +0 -6
  119. data/lib/pry/rbx_method.rb +0 -13
  120. data/man/pry.1 +0 -195
  121. data/man/pry.1.html +0 -204
  122. data/man/pry.1.ronn +0 -141
  123. data/pry.gemspec +0 -29
  124. data/spec/Procfile +0 -3
  125. data/spec/cli_spec.rb +0 -78
  126. data/spec/code_object_spec.rb +0 -277
  127. data/spec/code_spec.rb +0 -219
  128. data/spec/command_helpers_spec.rb +0 -29
  129. data/spec/command_integration_spec.rb +0 -644
  130. data/spec/command_set_spec.rb +0 -627
  131. data/spec/command_spec.rb +0 -821
  132. data/spec/commands/amend_line_spec.rb +0 -247
  133. data/spec/commands/bang_spec.rb +0 -19
  134. data/spec/commands/cat_spec.rb +0 -164
  135. data/spec/commands/cd_spec.rb +0 -250
  136. data/spec/commands/disable_pry_spec.rb +0 -25
  137. data/spec/commands/edit_spec.rb +0 -727
  138. data/spec/commands/exit_all_spec.rb +0 -34
  139. data/spec/commands/exit_program_spec.rb +0 -19
  140. data/spec/commands/exit_spec.rb +0 -34
  141. data/spec/commands/find_method_spec.rb +0 -70
  142. data/spec/commands/gem_list_spec.rb +0 -26
  143. data/spec/commands/gist_spec.rb +0 -79
  144. data/spec/commands/help_spec.rb +0 -56
  145. data/spec/commands/hist_spec.rb +0 -181
  146. data/spec/commands/jump_to_spec.rb +0 -15
  147. data/spec/commands/ls_spec.rb +0 -181
  148. data/spec/commands/play_spec.rb +0 -140
  149. data/spec/commands/raise_up_spec.rb +0 -56
  150. data/spec/commands/save_file_spec.rb +0 -177
  151. data/spec/commands/show_doc_spec.rb +0 -510
  152. data/spec/commands/show_input_spec.rb +0 -17
  153. data/spec/commands/show_source_spec.rb +0 -782
  154. data/spec/commands/whereami_spec.rb +0 -203
  155. data/spec/completion_spec.rb +0 -241
  156. data/spec/control_d_handler_spec.rb +0 -58
  157. data/spec/documentation_helper_spec.rb +0 -73
  158. data/spec/editor_spec.rb +0 -79
  159. data/spec/exception_whitelist_spec.rb +0 -21
  160. data/spec/fixtures/candidate_helper1.rb +0 -11
  161. data/spec/fixtures/candidate_helper2.rb +0 -8
  162. data/spec/fixtures/example.erb +0 -5
  163. data/spec/fixtures/example_nesting.rb +0 -33
  164. data/spec/fixtures/show_source_doc_examples.rb +0 -15
  165. data/spec/fixtures/testrc +0 -2
  166. data/spec/fixtures/testrcbad +0 -2
  167. data/spec/fixtures/whereami_helper.rb +0 -6
  168. data/spec/helper.rb +0 -34
  169. data/spec/helpers/bacon.rb +0 -86
  170. data/spec/helpers/mock_pry.rb +0 -43
  171. data/spec/helpers/table_spec.rb +0 -105
  172. data/spec/history_array_spec.rb +0 -67
  173. data/spec/hooks_spec.rb +0 -522
  174. data/spec/indent_spec.rb +0 -301
  175. data/spec/input_stack_spec.rb +0 -90
  176. data/spec/method_spec.rb +0 -482
  177. data/spec/prompt_spec.rb +0 -60
  178. data/spec/pry_defaults_spec.rb +0 -419
  179. data/spec/pry_history_spec.rb +0 -99
  180. data/spec/pry_output_spec.rb +0 -95
  181. data/spec/pry_spec.rb +0 -515
  182. data/spec/run_command_spec.rb +0 -25
  183. data/spec/sticky_locals_spec.rb +0 -157
  184. data/spec/syntax_checking_spec.rb +0 -81
  185. data/spec/wrapped_module_spec.rb +0 -261
  186. data/wiki/Customizing-pry.md +0 -397
  187. data/wiki/Home.md +0 -4
@@ -1,510 +0,0 @@
1
- require 'helper'
2
- require "fixtures/show_source_doc_examples"
3
-
4
- if !PryTestHelpers.mri18_and_no_real_source_location?
5
- describe "show-doc" do
6
- before do
7
- @o = Object.new
8
-
9
- # sample doc
10
- def @o.sample_method
11
- :sample
12
- end
13
- end
14
-
15
- it 'should output a method\'s documentation' do
16
- pry_eval(binding, "show-doc @o.sample_method").should =~ /sample doc/
17
- end
18
-
19
- it 'should output a method\'s documentation with line numbers' do
20
- pry_eval(binding, "show-doc @o.sample_method -l").should =~ /\d: sample doc/
21
- end
22
-
23
- it 'should output a method\'s documentation with line numbers (base one)' do
24
- pry_eval(binding, "show-doc @o.sample_method -b").should =~ /1: sample doc/
25
- end
26
-
27
- it 'should output a method\'s documentation if inside method without needing to use method name' do
28
- # sample comment
29
- def @o.sample
30
- pry_eval(binding, 'show-doc').should =~ /sample comment/
31
- end
32
- @o.sample
33
- end
34
-
35
- it "should be able to find super methods" do
36
- b = Class.new{
37
- # daddy initialize!
38
- def initialize(*args) ;end
39
- }
40
-
41
- c = Class.new(b){
42
- # classy initialize!
43
- def initialize(*args); end
44
- }
45
-
46
- d = Class.new(c){
47
- # grungy initialize??
48
- def initialize(*args, &block); end
49
- }
50
-
51
- o = d.new
52
-
53
- # instancey initialize!
54
- def o.initialize; end
55
-
56
- t = pry_tester(binding)
57
-
58
- t.eval("show-doc o.initialize").should =~ /instancey initialize/
59
- t.eval("show-doc --super o.initialize").should =~ /grungy initialize/
60
- t.eval("show-doc o.initialize -ss").should =~ /classy initialize/
61
- t.eval("show-doc o.initialize -sss").should =~ /daddy initialize/
62
- end
63
-
64
- describe "rdoc highlighting" do
65
- it "should syntax highlight code in rdoc" do
66
- c = Class.new{
67
- # This can initialize your class:
68
- #
69
- # a = c.new :foo
70
- #
71
- # @param foo
72
- def initialize(foo); end
73
- }
74
-
75
- begin
76
- t = pry_tester(binding)
77
- t.eval("show-doc c#initialize").should =~ /c.new :foo/
78
- Pry.config.color = true
79
- # I don't want the test to rely on which colour codes are there, just to
80
- # assert that "something" is being colourized.
81
- t.eval("show-doc c#initialize").should.not =~ /c.new :foo/
82
- ensure
83
- Pry.config.color = false
84
- end
85
- end
86
-
87
- it "should syntax highlight `code` in rdoc" do
88
- c = Class.new{
89
- # After initializing your class with `c.new(:foo)`, go have fun!
90
- #
91
- # @param foo
92
- def initialize(foo); end
93
- }
94
-
95
- begin
96
- t = pry_tester(binding)
97
- t.eval("show-doc c#initialize").should =~ /c.new\(:foo\)/
98
- Pry.config.color = true
99
- # I don't want the test to rely on which colour codes are there, just to
100
- # assert that "something" is being colourized.
101
- t.eval("show-doc c#initialize").should.not =~ /c.new\(:foo\)/
102
- ensure
103
- Pry.config.color = false
104
- end
105
-
106
- end
107
-
108
- it "should not syntax highlight `` inside code" do
109
- c = Class.new{
110
- # Convert aligned output (from many shell commands) into nested arrays:
111
- #
112
- # a = decolumnize `ls -l $HOME`
113
- #
114
- # @param output
115
- def decolumnize(output); end
116
- }
117
-
118
- begin
119
- t = pry_tester(binding)
120
- Pry.config.color = true
121
- t.eval("show-doc c#decolumnize").should =~ /ls -l \$HOME/
122
- t.eval("show-doc c#decolumnize").should.not =~ /`ls -l \$HOME`/
123
- ensure
124
- Pry.config.color = false
125
- end
126
- end
127
- end
128
-
129
- describe "on sourcable objects" do
130
- it "should show documentation for object" do
131
- # this is a documentation
132
- hello = proc { puts 'hello world!' }
133
- mock_pry(binding, "show-doc hello").should =~ /this is a documentation/
134
- end
135
- end
136
-
137
- describe "on modules" do
138
- before do
139
- # god this is boring1
140
- class ShowSourceTestClass
141
- def alpha
142
- end
143
- end
144
-
145
- # god this is boring2
146
- module ShowSourceTestModule
147
- def alpha
148
- end
149
- end
150
-
151
- # god this is boring3
152
- ShowSourceTestClassWeirdSyntax = Class.new do
153
- def beta
154
- end
155
- end
156
-
157
- # god this is boring4
158
- ShowSourceTestModuleWeirdSyntax = Module.new do
159
- def beta
160
- end
161
- end
162
- end
163
-
164
- after do
165
- Object.remove_const :ShowSourceTestClass
166
- Object.remove_const :ShowSourceTestClassWeirdSyntax
167
- Object.remove_const :ShowSourceTestModule
168
- Object.remove_const :ShowSourceTestModuleWeirdSyntax
169
- end
170
-
171
- describe "basic functionality, should show docs for top-level module definitions" do
172
- it 'should show docs for a class' do
173
- pry_eval("show-doc ShowSourceTestClass").should =~
174
- /god this is boring1/
175
- end
176
-
177
- it 'should show docs for a module' do
178
- pry_eval("show-doc ShowSourceTestModule").should =~
179
- /god this is boring2/
180
- end
181
-
182
- it 'should show docs for a class when Const = Class.new syntax is used' do
183
- pry_eval("show-doc ShowSourceTestClassWeirdSyntax").should =~
184
- /god this is boring3/
185
- end
186
-
187
- it 'should show docs for a module when Const = Module.new syntax is used' do
188
- pry_eval("show-doc ShowSourceTestModuleWeirdSyntax").should =~
189
- /god this is boring4/
190
- end
191
- end
192
-
193
- if !Pry::Helpers::BaseHelpers.mri_18?
194
- describe "in REPL" do
195
- it 'should find class defined in repl' do
196
- t = pry_tester
197
- t.eval <<-RUBY
198
- # hello tobina
199
- class TobinaMyDog
200
- def woof
201
- end
202
- end
203
- RUBY
204
- t.eval('show-doc TobinaMyDog').should =~ /hello tobina/
205
- Object.remove_const :TobinaMyDog
206
- end
207
- end
208
- end
209
-
210
- it 'should lookup module name with respect to current context' do
211
- constant_scope(:AlphaClass, :BetaClass) do
212
- # top-level beta
213
- class BetaClass
214
- def alpha
215
- end
216
- end
217
-
218
- class AlphaClass
219
- # nested beta
220
- class BetaClass
221
- def beta
222
- end
223
- end
224
- end
225
-
226
- pry_eval(AlphaClass, "show-doc BetaClass").should =~ /nested beta/
227
- end
228
- end
229
-
230
- it 'should look up nested modules' do
231
- constant_scope(:AlphaClass) do
232
- class AlphaClass
233
- # nested beta
234
- class BetaClass
235
- def beta
236
- end
237
- end
238
- end
239
-
240
- pry_eval("show-doc AlphaClass::BetaClass").should =~
241
- /nested beta/
242
- end
243
- end
244
-
245
- describe "show-doc -a" do
246
- it 'should show the docs for all monkeypatches defined in different files' do
247
- # local monkeypatch
248
- class TestClassForShowSource
249
- def beta
250
- end
251
- end
252
-
253
- result = pry_eval("show-doc TestClassForShowSource -a")
254
- result.should =~ /used by/
255
- result.should =~ /local monkeypatch/
256
- end
257
-
258
- describe "messages relating to -a" do
259
- it 'indicates all available monkeypatches can be shown with -a when (when -a not used and more than one candidate exists for class)' do
260
- class TestClassForShowSource
261
- def beta
262
- end
263
- end
264
-
265
- result = pry_eval('show-doc TestClassForShowSource')
266
- result.should =~ /available monkeypatches/
267
- end
268
-
269
- it 'shouldnt say anything about monkeypatches when only one candidate exists for selected class' do
270
- class Aarrrrrghh
271
- def o;end
272
- end
273
-
274
- result = pry_eval('show-doc Aarrrrrghh')
275
- result.should.not =~ /available monkeypatches/
276
- Object.remove_const(:Aarrrrrghh)
277
- end
278
- end
279
- end
280
-
281
- describe "when no class/module arg is given" do
282
- before do
283
- module TestHost
284
-
285
- # hello there froggy
286
- module M
287
- def d; end
288
- def e; end
289
- end
290
- end
291
- end
292
-
293
- after do
294
- Object.remove_const(:TestHost)
295
- end
296
-
297
- it 'should return doc for current module' do
298
- pry_eval(TestHost::M, "show-doc").should =~ /hello there froggy/
299
- end
300
- end
301
-
302
- # FIXME: THis is nto a good spec anyway, because i dont think it
303
- # SHOULD skip!
304
- describe "should skip over broken modules" do
305
- before do
306
- module TestHost
307
- # hello
308
- module M
309
- binding.eval("def a; end", "dummy.rb", 1)
310
- binding.eval("def b; end", "dummy.rb", 2)
311
- binding.eval("def c; end", "dummy.rb", 3)
312
- end
313
-
314
- # goodbye
315
- module M
316
- def d; end
317
- def e; end
318
- end
319
- end
320
- end
321
-
322
- after do
323
- Object.remove_const(:TestHost)
324
- end
325
-
326
- it 'should return doc for first valid module' do
327
- result = pry_eval("show-doc TestHost::M")
328
- result.should =~ /goodbye/
329
- result.should.not =~ /hello/
330
- end
331
- end
332
- end
333
-
334
- describe "on commands" do
335
- # mostly copied & modified from test_help.rb
336
- before do
337
- @oldset = Pry.config.commands
338
- @set = Pry.config.commands = Pry::CommandSet.new do
339
- import Pry::Commands
340
- end
341
- end
342
-
343
- after do
344
- Pry.config.commands = @oldset
345
- end
346
-
347
- it 'should display help for a specific command' do
348
- pry_eval('show-doc ls').should =~ /Usage: ls/
349
- end
350
-
351
- it 'should display help for a regex command with a "listing"' do
352
- @set.command /bar(.*)/, "Test listing", :listing => "foo" do; end
353
- pry_eval('show-doc foo').should =~ /Test listing/
354
- end
355
-
356
- it 'should display help for a command with a spaces in its name' do
357
- @set.command "command with spaces", "description of a command with spaces" do; end
358
- pry_eval('show-doc command with spaces').should =~ /description of a command with spaces/
359
- end
360
-
361
- describe "class commands" do
362
- before do
363
- # pretty pink pincers
364
- class LobsterLady < Pry::ClassCommand
365
- match "lobster-lady"
366
- description "nada."
367
- def process
368
- "lobster"
369
- end
370
- end
371
-
372
- Pry.commands.add_command(LobsterLady)
373
- end
374
-
375
- after do
376
- Object.remove_const(:LobsterLady)
377
- end
378
-
379
- it 'should display "help" when looking up by command name' do
380
- pry_eval('show-doc lobster-lady').should =~ /nada/
381
- Pry.commands.delete("lobster-lady")
382
- end
383
-
384
- it 'should display actual preceding comment for a class command, when class is used (rather than command name) when looking up' do
385
- pry_eval('show-doc LobsterLady').should =~ /pretty pink pincers/
386
- Pry.commands.delete("lobster-lady")
387
- end
388
- end
389
- end
390
-
391
- describe "should set _file_ and _dir_" do
392
- it 'should set _file_ and _dir_ to file containing method source' do
393
- t = pry_tester
394
- t.process_command "show-doc TestClassForShowSource#alpha"
395
- t.pry.last_file.should =~ /show_source_doc_examples/
396
- t.pry.last_dir.should =~ /fixtures/
397
- end
398
- end
399
-
400
- unless Pry::Helpers::BaseHelpers.rbx?
401
- describe "can't find class docs" do
402
- describe "for classes" do
403
- before do
404
- module Jesus
405
- class Brian; end
406
-
407
- # doink-doc
408
- class Jingle
409
- def a; :doink; end
410
- end
411
-
412
- class Jangle < Jingle; end
413
- class Bangle < Jangle; end
414
- end
415
- end
416
-
417
- after do
418
- Object.remove_const(:Jesus)
419
- end
420
-
421
- it 'shows superclass doc' do
422
- t = pry_tester
423
- t.process_command "show-doc Jesus::Jangle"
424
- t.last_output.should =~ /doink-doc/
425
- end
426
-
427
- it 'errors when class has no superclass to show' do
428
- t = pry_tester
429
- lambda { t.process_command "show-doc Jesus::Brian" }.should.raise(Pry::CommandError).message.
430
- should =~ /Couldn't locate/
431
- end
432
-
433
- it 'shows warning when reverting to superclass docs' do
434
- t = pry_tester
435
- t.process_command "show-doc Jesus::Jangle"
436
- t.last_output.should =~ /Warning.*?Cannot find.*?Jesus::Jangle.*Showing.*Jesus::Jingle instead/
437
- end
438
-
439
- it 'shows nth level superclass docs (when no intermediary superclasses have code either)' do
440
- t = pry_tester
441
- t.process_command "show-doc Jesus::Bangle"
442
- t.last_output.should =~ /doink-doc/
443
- end
444
-
445
- it 'shows correct warning when reverting to nth level superclass' do
446
- t = pry_tester
447
- t.process_command "show-doc Jesus::Bangle"
448
- t.last_output.should =~ /Warning.*?Cannot find.*?Jesus::Bangle.*Showing.*Jesus::Jingle instead/
449
- end
450
- end
451
-
452
- describe "for modules" do
453
- before do
454
- module Jesus
455
-
456
- # alpha-doc
457
- module Alpha
458
- def alpha; :alpha; end
459
- end
460
-
461
- module Zeta; end
462
-
463
- module Beta
464
- include Alpha
465
- end
466
-
467
- module Gamma
468
- include Beta
469
- end
470
- end
471
- end
472
-
473
- after do
474
- Object.remove_const(:Jesus)
475
- end
476
-
477
- it 'shows included module doc' do
478
- t = pry_tester
479
- t.process_command "show-doc Jesus::Beta"
480
- t.last_output.should =~ /alpha-doc/
481
- end
482
-
483
- it 'shows warning when reverting to included module doc' do
484
- t = pry_tester
485
- t.process_command "show-doc Jesus::Beta"
486
- t.last_output.should =~ /Warning.*?Cannot find.*?Jesus::Beta.*Showing.*Jesus::Alpha instead/
487
- end
488
-
489
- it 'errors when module has no included module to show' do
490
- t = pry_tester
491
- lambda { t.process_command "show-source Jesus::Zeta" }.should.raise(Pry::CommandError).message.
492
- should =~ /Couldn't locate/
493
- end
494
-
495
- it 'shows nth level included module doc (when no intermediary modules have code either)' do
496
- t = pry_tester
497
- t.process_command "show-doc Jesus::Gamma"
498
- t.last_output.should =~ /alpha-doc/
499
- end
500
-
501
- it 'shows correct warning when reverting to nth level included module' do
502
- t = pry_tester
503
- t.process_command "show-source Jesus::Gamma"
504
- t.last_output.should =~ /Warning.*?Cannot find.*?Jesus::Gamma.*Showing.*Jesus::Alpha instead/
505
- end
506
- end
507
- end
508
- end
509
- end
510
- end