pry 0.9.12pre2-java → 0.9.12pre3-java

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.
@@ -126,6 +126,12 @@ class Pry
126
126
  h << "@ line #{line_num}:\n"
127
127
  h << text.bold(code_object.module? ? "Module" : "Class")
128
128
  h << " #{text.bold('name:')} #{code_object.nonblank_name}"
129
+
130
+ if code_object.number_of_candidates > 1
131
+ h << (text.bold("\nNumber of monkeypatches: ") + code_object.number_of_candidates.to_s)
132
+ h << ". Use the `-a` option to display all available monkeypatches"
133
+ end
134
+ h
129
135
  end
130
136
 
131
137
  def method_sections(code_object)
@@ -71,10 +71,16 @@ class Pry
71
71
  # get new target for 1/2 and find candidates for 3
72
72
  path, input = build_path(input)
73
73
 
74
- # we silence warnings here or ruby 1.8 cries about "multiple values for block 0 for 1"
74
+ # We silence warnings here or Ruby 1.8 cries about "multiple values for
75
+ # block 0 for 1".
75
76
  Helpers::BaseHelpers.silence_warnings do
76
77
  unless path.call.empty?
77
- target, _ = Pry::Helpers::BaseHelpers.context_from_object_path(path.call, pry)
78
+ target = begin
79
+ ctx = Helpers::BaseHelpers.context_from_object_path(path.call, pry)
80
+ ctx.first
81
+ rescue Pry::CommandError
82
+ []
83
+ end
78
84
  target = target.last
79
85
  end
80
86
  end
@@ -23,9 +23,10 @@ class Pry
23
23
  # Methods to delegate to associated `Pry::WrappedModule
24
24
  # instance`.
25
25
  private_delegates = [:lines_for_file, :method_candidates,
26
- :yard_docs?, :number_of_candidates]
26
+ :yard_docs?]
27
27
 
28
- public_delegates = [:wrapped, :module?, :class?, :name, :nonblank_name]
28
+ public_delegates = [:wrapped, :module?, :class?, :name, :nonblank_name,
29
+ :number_of_candidates]
29
30
 
30
31
  def_delegators :@wrapper, *(private_delegates + public_delegates)
31
32
  private *private_delegates
@@ -27,8 +27,7 @@ class Pry::Pager
27
27
  end
28
28
 
29
29
  def self.page_size
30
- rows = Pry::Terminal.screen_size
31
- @page_size ||= (rows && rows.first || 27)
30
+ @page_size ||= Pry::Terminal.height!
32
31
  end
33
32
 
34
33
  def initialize(text)
@@ -50,6 +50,8 @@ class Pry
50
50
  rescue LoadError => e
51
51
  warn "Found plugin #{gem_name}, but could not require '#{gem_name}'"
52
52
  warn e
53
+ rescue => e
54
+ warn "require '#{gem_name}' # Failed, saying: #{e}"
53
55
  end
54
56
 
55
57
  self.active = true
@@ -13,15 +13,20 @@ class Pry::Terminal
13
13
  end
14
14
 
15
15
  # Return a screen size or a default if that fails.
16
- def size! default = [25, 80]
16
+ def size! default = [27, 80]
17
17
  screen_size || default
18
18
  end
19
19
 
20
20
  # Return a screen width or the default if that fails.
21
- def width! default = 80
21
+ def width!
22
22
  size![1]
23
23
  end
24
24
 
25
+ # Return a screen height or the default if that fails.
26
+ def height!
27
+ size![0]
28
+ end
29
+
25
30
  def actual_screen_size
26
31
  # The best way, if possible (requires non-jruby ≥1.9 or io-console gem)
27
32
  screen_size_according_to_io_console or
@@ -1,3 +1,3 @@
1
1
  class Pry
2
- VERSION = "0.9.12pre2"
2
+ VERSION = "0.9.12pre3"
3
3
  end
@@ -0,0 +1,3 @@
1
+ # Run this with:
2
+ # gem install foreman && foreman start -f spec/Procfile
3
+ pryhere: sh -c '(cd ..; rake pry)'
@@ -200,286 +200,311 @@ if !PryTestHelpers.mri18_and_no_real_source_location?
200
200
  def woof
201
201
  end
202
202
  end
203
- RUBY
204
- t.eval('show-doc TobinaMyDog').should =~ /hello tobina/
205
- Object.remove_const :TobinaMyDog
203
+ RUBY
204
+ t.eval('show-doc TobinaMyDog').should =~ /hello tobina/
205
+ Object.remove_const :TobinaMyDog
206
+ end
206
207
  end
207
208
  end
208
- end
209
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
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
215
216
  end
216
- end
217
217
 
218
- class AlphaClass
219
- # nested beta
220
- class BetaClass
221
- def beta
218
+ class AlphaClass
219
+ # nested beta
220
+ class BetaClass
221
+ def beta
222
+ end
222
223
  end
223
224
  end
224
- end
225
225
 
226
- pry_eval(AlphaClass, "show-doc BetaClass").should =~ /nested beta/
226
+ pry_eval(AlphaClass, "show-doc BetaClass").should =~ /nested beta/
227
+ end
227
228
  end
228
- end
229
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
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
236
237
  end
237
238
  end
238
- end
239
239
 
240
- pry_eval("show-doc AlphaClass::BetaClass").should =~
241
- /nested beta/
240
+ pry_eval("show-doc AlphaClass::BetaClass").should =~
241
+ /nested beta/
242
+ end
242
243
  end
243
- end
244
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
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
250
251
  end
251
- end
252
252
 
253
- result = pry_eval("show-doc TestClassForShowSource -a")
254
- result.should =~ /used by/
255
- result.should =~ /local monkeypatch/
256
- end
257
- end
253
+ result = pry_eval("show-doc TestClassForShowSource -a")
254
+ result.should =~ /used by/
255
+ result.should =~ /local monkeypatch/
256
+ end
258
257
 
259
- describe "when no class/module arg is given" do
260
- before do
261
- module TestHost
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
262
264
 
263
- # hello there froggy
264
- module M
265
- def d; end
266
- def e; end
265
+ result = pry_eval('show-doc TestClassForShowSource')
266
+ result.should =~ /available monkeypatches/
267
267
  end
268
- end
269
- end
270
268
 
271
- after do
272
- Object.remove_const(:TestHost)
273
- end
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
274
273
 
275
- it 'should return doc for current module' do
276
- pry_eval(TestHost::M, "show-doc").should =~ /hello there froggy/
274
+ result = pry_eval('show-doc Aarrrrrghh')
275
+ result.should.not =~ /available monkeypatches/
276
+ Object.remove_const(:Aarrrrrghh)
277
+ end
278
+ end
277
279
  end
278
- end
279
280
 
280
- # FIXME: THis is nto a good spec anyway, because i dont think it
281
- # SHOULD skip!
282
- describe "should skip over broken modules" do
283
- before do
284
- module TestHost
285
- # hello
286
- module M
287
- binding.eval("def a; end", "dummy.rb", 1)
288
- binding.eval("def b; end", "dummy.rb", 2)
289
- binding.eval("def c; end", "dummy.rb", 3)
290
- end
281
+ describe "when no class/module arg is given" do
282
+ before do
283
+ module TestHost
291
284
 
292
- # goodbye
293
- module M
294
- def d; end
295
- def e; end
285
+ # hello there froggy
286
+ module M
287
+ def d; end
288
+ def e; end
289
+ end
296
290
  end
297
291
  end
298
- end
299
292
 
300
- after do
301
- Object.remove_const(:TestHost)
302
- end
293
+ after do
294
+ Object.remove_const(:TestHost)
295
+ end
303
296
 
304
- it 'should return doc for first valid module' do
305
- result = pry_eval("show-doc TestHost::M")
306
- result.should =~ /goodbye/
307
- result.should.not =~ /hello/
297
+ it 'should return doc for current module' do
298
+ pry_eval(TestHost::M, "show-doc").should =~ /hello there froggy/
299
+ end
308
300
  end
309
- end
310
- end
311
301
 
312
- describe "on commands" do
313
- # mostly copied & modified from test_help.rb
314
- before do
315
- @oldset = Pry.config.commands
316
- @set = Pry.config.commands = Pry::CommandSet.new do
317
- import Pry::Commands
318
- end
319
- end
320
-
321
- after do
322
- Pry.config.commands = @oldset
323
- end
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
324
313
 
325
- it 'should display help for a specific command' do
326
- pry_eval('show-doc ls').should =~ /Usage: ls/
327
- end
314
+ # goodbye
315
+ module M
316
+ def d; end
317
+ def e; end
318
+ end
319
+ end
320
+ end
328
321
 
329
- it 'should display help for a regex command with a "listing"' do
330
- @set.command /bar(.*)/, "Test listing", :listing => "foo" do; end
331
- pry_eval('show-doc foo').should =~ /Test listing/
332
- end
322
+ after do
323
+ Object.remove_const(:TestHost)
324
+ end
333
325
 
334
- it 'should display help for a command with a spaces in its name' do
335
- @set.command "command with spaces", "description of a command with spaces" do; end
336
- pry_eval('show-doc command with spaces').should =~ /description of a command with spaces/
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
337
332
  end
338
333
 
339
- describe "class commands" do
334
+ describe "on commands" do
335
+ # mostly copied & modified from test_help.rb
340
336
  before do
341
- # pretty pink pincers
342
- class LobsterLady < Pry::ClassCommand
343
- match "lobster-lady"
344
- description "nada."
345
- def process
346
- "lobster"
347
- end
337
+ @oldset = Pry.config.commands
338
+ @set = Pry.config.commands = Pry::CommandSet.new do
339
+ import Pry::Commands
348
340
  end
349
-
350
- Pry.commands.add_command(LobsterLady)
351
341
  end
352
342
 
353
343
  after do
354
- Object.remove_const(:LobsterLady)
344
+ Pry.config.commands = @oldset
355
345
  end
356
346
 
357
- it 'should display "help" when looking up by command name' do
358
- pry_eval('show-doc lobster-lady').should =~ /nada/
359
- Pry.commands.delete("lobster-lady")
347
+ it 'should display help for a specific command' do
348
+ pry_eval('show-doc ls').should =~ /Usage: ls/
360
349
  end
361
350
 
362
- it 'should display actual preceding comment for a class command, when class is used (rather than command name) when looking up' do
363
- pry_eval('show-doc LobsterLady').should =~ /pretty pink pincers/
364
- Pry.commands.delete("lobster-lady")
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/
365
354
  end
366
- end
367
- end
368
-
369
- describe "should set _file_ and _dir_" do
370
- it 'should set _file_ and _dir_ to file containing method source' do
371
- t = pry_tester
372
- t.process_command "show-doc TestClassForShowSource#alpha"
373
- t.pry.last_file.should =~ /show_source_doc_examples/
374
- t.pry.last_dir.should =~ /fixtures/
375
- end
376
- end
377
355
 
378
- describe "can't find class docs" do
379
- describe "for classes" do
380
- before do
381
- module Jesus
382
- class Brian; end
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
383
360
 
384
- # doink-doc
385
- class Jingle
386
- def a; :doink; end
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
387
370
  end
388
371
 
389
- class Jangle < Jingle; end
390
- class Bangle < Jangle; end
372
+ Pry.commands.add_command(LobsterLady)
391
373
  end
392
- end
393
374
 
394
- after do
395
- Object.remove_const(:Jesus)
396
- end
375
+ after do
376
+ Object.remove_const(:LobsterLady)
377
+ end
397
378
 
398
- it 'shows superclass doc' do
399
- t = pry_tester
400
- t.process_command "show-doc Jesus::Jangle"
401
- t.last_output.should =~ /doink-doc/
402
- end
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
403
383
 
404
- it 'errors when class has no superclass to show' do
405
- t = pry_tester
406
- lambda { t.process_command "show-doc Jesus::Brian" }.should.raise(Pry::CommandError).message.
407
- should =~ /Couldn't locate/
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
408
388
  end
389
+ end
409
390
 
410
- it 'shows warning when reverting to superclass docs' do
391
+ describe "should set _file_ and _dir_" do
392
+ it 'should set _file_ and _dir_ to file containing method source' do
411
393
  t = pry_tester
412
- t.process_command "show-doc Jesus::Jangle"
413
- t.last_output.should =~ /Warning.*?Cannot find.*?Jesus::Jangle.*Showing.*Jesus::Jingle instead/
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/
414
397
  end
398
+ end
415
399
 
416
- it 'shows nth level superclass docs (when no intermediary superclasses have code either)' do
417
- t = pry_tester
418
- t.process_command "show-doc Jesus::Bangle"
419
- t.last_output.should =~ /doink-doc/
420
- end
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
421
406
 
422
- it 'shows correct warning when reverting to nth level superclass' do
423
- t = pry_tester
424
- t.process_command "show-doc Jesus::Bangle"
425
- t.last_output.should =~ /Warning.*?Cannot find.*?Jesus::Bangle.*Showing.*Jesus::Jingle instead/
426
- end
427
- end
428
- describe "for modules" do
429
- before do
430
- module Jesus
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
431
426
 
432
- # alpha-doc
433
- module Alpha
434
- def alpha; :alpha; end
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/
435
431
  end
436
432
 
437
- module Zeta; end
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
438
 
439
- module Beta
440
- include Alpha
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/
441
443
  end
442
444
 
443
- module Gamma
444
- include Beta
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/
445
449
  end
446
450
  end
447
- end
448
451
 
449
- after do
450
- Object.remove_const(:Jesus)
451
- end
452
+ describe "for modules" do
453
+ before do
454
+ module Jesus
452
455
 
453
- it 'shows included module doc' do
454
- t = pry_tester
455
- t.process_command "show-doc Jesus::Beta"
456
- t.last_output.should =~ /alpha-doc/
457
- end
456
+ # alpha-doc
457
+ module Alpha
458
+ def alpha; :alpha; end
459
+ end
458
460
 
459
- it 'shows warning when reverting to included module doc' do
460
- t = pry_tester
461
- t.process_command "show-doc Jesus::Beta"
462
- t.last_output.should =~ /Warning.*?Cannot find.*?Jesus::Beta.*Showing.*Jesus::Alpha instead/
463
- end
461
+ module Zeta; end
464
462
 
465
- it 'errors when module has no included module to show' do
466
- t = pry_tester
467
- lambda { t.process_command "show-source Jesus::Zeta" }.should.raise(Pry::CommandError).message.
468
- should =~ /Couldn't locate/
469
- end
463
+ module Beta
464
+ include Alpha
465
+ end
470
466
 
471
- it 'shows nth level included module doc (when no intermediary modules have code either)' do
472
- t = pry_tester
473
- t.process_command "show-doc Jesus::Gamma"
474
- t.last_output.should =~ /alpha-doc/
475
- end
467
+ module Gamma
468
+ include Beta
469
+ end
470
+ end
471
+ end
476
472
 
477
- it 'shows correct warning when reverting to nth level included module' do
478
- t = pry_tester
479
- t.process_command "show-source Jesus::Gamma"
480
- t.last_output.should =~ /Warning.*?Cannot find.*?Jesus::Gamma.*Showing.*Jesus::Alpha instead/
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
481
507
  end
482
508
  end
483
509
  end
484
510
  end
485
- end
@@ -453,6 +453,28 @@ if !PryTestHelpers.mri18_and_no_real_source_location?
453
453
  result = pry_eval('show-source TestClassForShowSourceInstanceEval -a')
454
454
  result.should =~ /def instance_eval_method/
455
455
  end
456
+
457
+ describe "messages relating to -a" do
458
+ it 'indicates all available monkeypatches can be shown with -a when (when -a not used and more than one candidate exists for class)' do
459
+ class TestClassForShowSource
460
+ def beta
461
+ end
462
+ end
463
+
464
+ result = pry_eval('show-source TestClassForShowSource')
465
+ result.should =~ /available monkeypatches/
466
+ end
467
+
468
+ it 'shouldnt say anything about monkeypatches when only one candidate exists for selected class' do
469
+ class Aarrrrrghh
470
+ def o;end
471
+ end
472
+
473
+ result = pry_eval('show-source Aarrrrrghh')
474
+ result.should.not =~ /available monkeypatches/
475
+ Object.remove_const(:Aarrrrrghh)
476
+ end
477
+ end
456
478
  end
457
479
 
458
480
  describe "when show-source is invoked without a method or class argument" do
@@ -641,116 +663,118 @@ if !PryTestHelpers.mri18_and_no_real_source_location?
641
663
  end
642
664
  end
643
665
 
644
- describe "can't find class/module code" do
645
- describe "for classes" do
646
- before do
647
- module Jesus
648
- module Pig
649
- def lillybing; :lillybing; end
650
- end
666
+ unless Pry::Helpers::BaseHelpers.rbx?
667
+ describe "can't find class/module code" do
668
+ describe "for classes" do
669
+ before do
670
+ module Jesus
671
+ module Pig
672
+ def lillybing; :lillybing; end
673
+ end
651
674
 
652
- class Brian; end
653
- class Jingle
654
- def a; :doink; end
655
- end
675
+ class Brian; end
676
+ class Jingle
677
+ def a; :doink; end
678
+ end
656
679
 
657
- class Jangle < Jingle; include Pig; end
658
- class Bangle < Jangle; end
680
+ class Jangle < Jingle; include Pig; end
681
+ class Bangle < Jangle; end
682
+ end
659
683
  end
660
- end
661
684
 
662
- after do
663
- Object.remove_const(:Jesus)
664
- end
685
+ after do
686
+ Object.remove_const(:Jesus)
687
+ end
665
688
 
666
- it 'shows superclass code' do
667
- t = pry_tester
668
- t.process_command "show-source Jesus::Jangle"
669
- t.last_output.should =~ /doink/
670
- end
689
+ it 'shows superclass code' do
690
+ t = pry_tester
691
+ t.process_command "show-source Jesus::Jangle"
692
+ t.last_output.should =~ /doink/
693
+ end
671
694
 
672
- it 'ignores included modules' do
673
- t = pry_tester
674
- t.process_command "show-source Jesus::Jangle"
675
- t.last_output.should.not =~ /lillybing/
676
- end
695
+ it 'ignores included modules' do
696
+ t = pry_tester
697
+ t.process_command "show-source Jesus::Jangle"
698
+ t.last_output.should.not =~ /lillybing/
699
+ end
677
700
 
678
- it 'errors when class has no superclass to show' do
679
- t = pry_tester
680
- lambda { t.process_command "show-source Jesus::Brian" }.should.raise(Pry::CommandError).message.
681
- should =~ /Couldn't locate/
682
- end
701
+ it 'errors when class has no superclass to show' do
702
+ t = pry_tester
703
+ lambda { t.process_command "show-source Jesus::Brian" }.should.raise(Pry::CommandError).message.
704
+ should =~ /Couldn't locate/
705
+ end
683
706
 
684
- it 'shows warning when reverting to superclass code' do
685
- t = pry_tester
686
- t.process_command "show-source Jesus::Jangle"
687
- t.last_output.should =~ /Warning.*?Cannot find.*?Jesus::Jangle.*Showing.*Jesus::Jingle instead/
688
- end
707
+ it 'shows warning when reverting to superclass code' do
708
+ t = pry_tester
709
+ t.process_command "show-source Jesus::Jangle"
710
+ t.last_output.should =~ /Warning.*?Cannot find.*?Jesus::Jangle.*Showing.*Jesus::Jingle instead/
711
+ end
689
712
 
690
- it 'shows nth level superclass code (when no intermediary superclasses have code either)' do
691
- t = pry_tester
692
- t.process_command "show-source Jesus::Bangle"
693
- t.last_output.should =~ /doink/
694
- end
713
+ it 'shows nth level superclass code (when no intermediary superclasses have code either)' do
714
+ t = pry_tester
715
+ t.process_command "show-source Jesus::Bangle"
716
+ t.last_output.should =~ /doink/
717
+ end
695
718
 
696
- it 'shows correct warning when reverting to nth level superclass' do
697
- t = pry_tester
698
- t.process_command "show-source Jesus::Bangle"
699
- t.last_output.should =~ /Warning.*?Cannot find.*?Jesus::Bangle.*Showing.*Jesus::Jingle instead/
719
+ it 'shows correct warning when reverting to nth level superclass' do
720
+ t = pry_tester
721
+ t.process_command "show-source Jesus::Bangle"
722
+ t.last_output.should =~ /Warning.*?Cannot find.*?Jesus::Bangle.*Showing.*Jesus::Jingle instead/
723
+ end
700
724
  end
701
- end
702
725
 
703
- describe "for modules" do
704
- before do
705
- module Jesus
706
- module Alpha
707
- def alpha; :alpha; end
708
- end
726
+ describe "for modules" do
727
+ before do
728
+ module Jesus
729
+ module Alpha
730
+ def alpha; :alpha; end
731
+ end
709
732
 
710
- module Zeta; end
733
+ module Zeta; end
711
734
 
712
- module Beta
713
- include Alpha
714
- end
735
+ module Beta
736
+ include Alpha
737
+ end
715
738
 
716
- module Gamma
717
- include Beta
739
+ module Gamma
740
+ include Beta
741
+ end
718
742
  end
719
743
  end
720
- end
721
744
 
722
- after do
723
- Object.remove_const(:Jesus)
724
- end
745
+ after do
746
+ Object.remove_const(:Jesus)
747
+ end
725
748
 
726
- it 'shows included module code' do
727
- t = pry_tester
728
- t.process_command "show-source Jesus::Beta"
729
- t.last_output.should =~ /alpha/
730
- end
749
+ it 'shows included module code' do
750
+ t = pry_tester
751
+ t.process_command "show-source Jesus::Beta"
752
+ t.last_output.should =~ /alpha/
753
+ end
731
754
 
732
- it 'shows warning when reverting to included module code' do
733
- t = pry_tester
734
- t.process_command "show-source Jesus::Beta"
735
- t.last_output.should =~ /Warning.*?Cannot find.*?Jesus::Beta.*Showing.*Jesus::Alpha instead/
736
- end
755
+ it 'shows warning when reverting to included module code' do
756
+ t = pry_tester
757
+ t.process_command "show-source Jesus::Beta"
758
+ t.last_output.should =~ /Warning.*?Cannot find.*?Jesus::Beta.*Showing.*Jesus::Alpha instead/
759
+ end
737
760
 
738
- it 'errors when module has no included module to show' do
739
- t = pry_tester
740
- lambda { t.process_command "show-source Jesus::Zeta" }.should.raise(Pry::CommandError).message.
741
- should =~ /Couldn't locate/
742
- end
761
+ it 'errors when module has no included module to show' do
762
+ t = pry_tester
763
+ lambda { t.process_command "show-source Jesus::Zeta" }.should.raise(Pry::CommandError).message.
764
+ should =~ /Couldn't locate/
765
+ end
743
766
 
744
- it 'shows nth level included module code (when no intermediary modules have code either)' do
745
- t = pry_tester
746
- t.process_command "show-source Jesus::Gamma"
747
- t.last_output.should =~ /alpha/
748
- end
767
+ it 'shows nth level included module code (when no intermediary modules have code either)' do
768
+ t = pry_tester
769
+ t.process_command "show-source Jesus::Gamma"
770
+ t.last_output.should =~ /alpha/
771
+ end
749
772
 
750
- it 'shows correct warning when reverting to nth level included module' do
751
- t = pry_tester
752
- t.process_command "show-source Jesus::Gamma"
753
- t.last_output.should =~ /Warning.*?Cannot find.*?Jesus::Gamma.*Showing.*Jesus::Alpha instead/
773
+ it 'shows correct warning when reverting to nth level included module' do
774
+ t = pry_tester
775
+ t.process_command "show-source Jesus::Gamma"
776
+ t.last_output.should =~ /Warning.*?Cannot find.*?Jesus::Gamma.*Showing.*Jesus::Alpha instead/
777
+ end
754
778
  end
755
779
  end
756
780
  end
@@ -230,4 +230,10 @@ describe Pry::InputCompleter do
230
230
  pry = Pry.new
231
231
  new_completer(binding, pry).call("pry.").should.not.include nil
232
232
  end
233
+
234
+ it "does not raise when complete file paths" do
235
+ should.not.raise(Pry::CommandError) {
236
+ new_completer(binding, Pry.new).call("cat lib/p")
237
+ }
238
+ end
233
239
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.12pre2
4
+ version: 0.9.12pre3
5
5
  prerelease: 6
6
6
  platform: java
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-02-07 00:00:00.000000000 Z
14
+ date: 2013-02-10 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: coderay
@@ -184,7 +184,6 @@ extensions: []
184
184
  extra_rdoc_files: []
185
185
  files:
186
186
  - .document
187
- - .gemtest
188
187
  - .gitignore
189
188
  - .travis.yml
190
189
  - .yardopts
@@ -296,6 +295,7 @@ files:
296
295
  - man/pry.1.html
297
296
  - man/pry.1.ronn
298
297
  - pry.gemspec
298
+ - spec/Procfile
299
299
  - spec/cli_spec.rb
300
300
  - spec/code_object_spec.rb
301
301
  - spec/code_spec.rb
@@ -384,6 +384,7 @@ signing_key:
384
384
  specification_version: 3
385
385
  summary: An IRB alternative and runtime developer console
386
386
  test_files:
387
+ - spec/Procfile
387
388
  - spec/cli_spec.rb
388
389
  - spec/code_object_spec.rb
389
390
  - spec/code_spec.rb
data/.gemtest DELETED
File without changes