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 33
33:   def initialize(input = "")
34:     ins = StringIO.new input
35:     outs = StringIO.new
36:     errs = StringIO.new
37: 
38:     ins.extend TTY
39:     outs.extend TTY
40:     errs.extend TTY
41: 
42:     super ins, outs, errs, true
43: 
44:     @terminated = false
45:   end

Public Instance methods

[Source]

    # File lib/rubygems/mock_gem_ui.rb, line 55
55:   def error
56:     @errs.string
57:   end

[Source]

    # File lib/rubygems/mock_gem_ui.rb, line 47
47:   def input
48:     @ins.string
49:   end

[Source]

    # File lib/rubygems/mock_gem_ui.rb, line 51
51:   def output
52:     @outs.string
53:   end

[Source]

    # File lib/rubygems/mock_gem_ui.rb, line 63
63:   def terminate_interaction(status=0)
64:     @terminated = true
65: 
66:     raise TermError, status if status != 0
67:     raise SystemExitException
68:   end

[Source]

    # File lib/rubygems/mock_gem_ui.rb, line 59
59:   def terminated?
60:     @terminated
61:   end

[Validate]