Sha256: 0f0943f6db09ac5a8efa68744d64303bf9cce2bec9215be92631a0424bfe82f5

Contents?: true

Size: 658 Bytes

Versions: 16

Compression:

Stored size: 658 Bytes

Contents

require 'minitest/autorun'
require 'shenanigans/object/display'
require 'stringio'

class Display < MiniTest::Unit::TestCase
  def setup
    @orig_stdout = $stdout
    $stdout = StringIO.new("", "r+")
  end

  def teardown
    $stdout = @orig_stdout
  end

  def test_display
    str = "foo"
    assert str.display == str
    $stdout.rewind
    assert $stdout.gets.chomp == str
  end

  def test_display_alias
    str = "foo"
    assert str.d == str
    $stdout.rewind
    assert $stdout.gets.chomp == str
  end

  def test_display_no_new_line
    str = "foo"
    assert str.display(false) == str
    $stdout.rewind
    assert $stdout.gets == str
  end

end

Version data entries

16 entries across 12 versions & 1 rubygems

Version Path
shenanigans-1.0.13 test/object/test_display.rb
shenanigans-1.0.11 test/object/test_display.rb
shenanigans-1.0.10 test/string/test_display.rb
shenanigans-1.0.10 test/object/test_display.rb
shenanigans-1.0.9 test/string/test_display.rb
shenanigans-1.0.9 test/object/test_display.rb
shenanigans-1.0.8 test/object/test_display.rb
shenanigans-1.0.8 test/string/test_display.rb
shenanigans-1.0.7 test/object/test_display.rb
shenanigans-1.0.7 test/string/test_display.rb
shenanigans-1.0.6 test/object/test_display.rb
shenanigans-1.0.5 test/object/test_display.rb
shenanigans-1.0.4 test/object/test_display.rb
shenanigans-1.0.3 test/object/test_display.rb
shenanigans-1.0.2 test/object/test_display.rb
shenanigans-1.0.1 test/object/test_display.rb