summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_console_ui.rb
blob: b8a619625fe099bff501ca594d1584c3c33bc621 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

require_relative "helper"
require "rubygems/user_interaction"

class TestGemConsoleUI < Gem::TestCase
  def test_output_can_be_captured_by_test_unit
    output = capture_output do
      ui = Gem::ConsoleUI.new

      ui.alert_error "test error"
      ui.alert_warning "test warning"
      ui.alert "test alert"
    end

    assert_equal "INFO:  test alert\n", output.first
    assert_equal "ERROR:  test error\n" + "WARNING:  test warning\n", output.last
  end
end