Class: Gem::MockGemUi (Ruby 2.3.4)

In Files

  • rubygems/mock_gem_ui.rb

Class/Module Index [+]

Quicksearch

Gem::MockGemUi

This Gem::StreamUI subclass records input and output to StringIO for retrieval during tests.

Public Class Methods

new(input = "")
 
               # File rubygems/mock_gem_ui.rb, line 45
def initialize(input = "")
  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
            

Public Instance Methods

ask(question)
 
               # File rubygems/mock_gem_ui.rb, line 59
def ask question
  raise InputEOFError, question if @ins.eof?

  super
end
            
error()
 
               # File rubygems/mock_gem_ui.rb, line 73
def error
  @errs.string
end
            
input()
 
               # File rubygems/mock_gem_ui.rb, line 65
def input
  @ins.string
end
            
output()
 
               # File rubygems/mock_gem_ui.rb, line 69
def output
  @outs.string
end
            
terminate_interaction(status=0)
 
               # File rubygems/mock_gem_ui.rb, line 81
def terminate_interaction(status=0)
  @terminated = true

  raise TermError, status if status != 0
  raise SystemExitException
end
            
terminated?()
 
               # File rubygems/mock_gem_ui.rb, line 77
def terminated?
  @terminated
end