Class: Gem::MockGemUi
  
  
  
Overview
  
    
This Gem::StreamUI subclass records input and output to StringIO for retrieval during tests.
   
 
  
Defined Under Namespace
  
    
      Modules: TTY
    
  
    
      Classes: InputEOFError, SystemExitException, TermError
    
  
  Instance Attribute Summary
  
  Attributes inherited from StreamUI
  #errs, #ins, #outs
  
    
      Instance Method Summary
      collapse
    
    
  
  
  
  
  
  
  
  
  
  Methods inherited from StreamUI
  #_gets_noecho, #alert, #alert_error, #alert_warning, #ask_for_password, #ask_yes_no, #backtrace, #choose_from_list, #close, #download_reporter, #progress_reporter, #require_io_console, #say, #tty?
  
  
  
  
  
  
  
  
  Methods included from Deprecate
  #deprecate, next_rubygems_major_version, rubygems_deprecate, rubygems_deprecate_command, skip, skip=, skip_during
  Constructor Details
  
    
  
  
    #initialize(input = "")  ⇒ MockGemUi 
  
  
  
  
    
Returns a new instance of MockGemUi.
   
 
  
  
    
      
43
44
45
46
47
48
49
50
51
52
53
54
55
56 
     | 
    
      # File 'lib/rubygems/mock_gem_ui.rb', line 43
def initialize(input = "")
  require "stringio"
  ins = StringIO.new input
  outs = StringIO.new
  errs = StringIO.new
  ins.extend TTY
  outs.extend TTY
  errs.extend TTY
  super ins, outs, errs, true
  @terminated = false
end 
     | 
  
 
  
 
  
    Instance Method Details
    
      
  
  
    #ask(question)  ⇒ Object 
  
  
  
  
    
      
58
59
60
61
62 
     | 
    
      # File 'lib/rubygems/mock_gem_ui.rb', line 58
def ask(question)
  raise InputEOFError, question if @ins.eof?
  super
end 
     | 
  
 
    
      
  
  
    #error  ⇒ Object 
  
  
  
  
    
      
72
73
74 
     | 
    
      # File 'lib/rubygems/mock_gem_ui.rb', line 72
def error
  @errs.string
end 
     | 
  
 
    
      
  
  
    
      
64
65
66 
     | 
    
      # File 'lib/rubygems/mock_gem_ui.rb', line 64
def input
  @ins.string
end 
     | 
  
 
    
      
  
  
    #output  ⇒ Object 
  
  
  
  
    
      
68
69
70 
     | 
    
      # File 'lib/rubygems/mock_gem_ui.rb', line 68
def output
  @outs.string
end 
     | 
  
 
    
      
  
  
    #terminate_interaction(status = 0)  ⇒ Object 
  
  
  
  
    
      
80
81
82
83
84
85 
     | 
    
      # File 'lib/rubygems/mock_gem_ui.rb', line 80
def terminate_interaction(status=0)
  @terminated = true
  raise TermError, status if status != 0
  raise SystemExitException
end 
     | 
  
 
    
      
  
  
    #terminated?  ⇒ Boolean 
  
  
  
  
    
      
76
77
78 
     | 
    
      # File 'lib/rubygems/mock_gem_ui.rb', line 76
def terminated?
  @terminated
end 
     |