Class Gem::MockGemUi
In: lib/rubygems/mock_gem_ui.rb
Parent: Gem::StreamUI

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

Methods

Classes and Modules

Module Gem::MockGemUi::TTY
Class Gem::MockGemUi::SystemExitException
Class Gem::MockGemUi::TermError

Public Class methods

[Source]

    # File lib/rubygems/mock_gem_ui.rb, line 26
26:   def initialize(input = "")
27:     ins = StringIO.new input
28:     outs = StringIO.new
29:     errs = StringIO.new
30: 
31:     ins.extend TTY
32:     outs.extend TTY
33:     errs.extend TTY
34: 
35:     super ins, outs, errs, true
36: 
37:     @terminated = false
38:   end

Public Instance methods

[Source]

    # File lib/rubygems/mock_gem_ui.rb, line 48
48:   def error
49:     @errs.string
50:   end

[Source]

    # File lib/rubygems/mock_gem_ui.rb, line 40
40:   def input
41:     @ins.string
42:   end

[Source]

    # File lib/rubygems/mock_gem_ui.rb, line 44
44:   def output
45:     @outs.string
46:   end

[Source]

    # File lib/rubygems/mock_gem_ui.rb, line 56
56:   def terminate_interaction(status=0)
57:     @terminated = true
58: 
59:     raise TermError unless status == 0
60:     raise SystemExitException, status
61:   end

[Source]

    # File lib/rubygems/mock_gem_ui.rb, line 52
52:   def terminated?
53:     @terminated
54:   end

[Validate]