Sha256: aa34979006a5b48fc5178a9269d20e5e7fc0aee9c75372ddb30550257d2adc1b

Contents?: true

Size: 669 Bytes

Versions: 1

Compression:

Stored size: 669 Bytes

Contents

require_relative 'test_helper'

class TestSpinner < Minitest::Test

  def test_spinner
    icons = %w(- \\ | /)

    spin_time = 0.5
    out = capture_output do
      Spinner.spin
      sleep spin_time
      Spinner.stop
    end

    s = out.string.clone
    ss = s.split("\b")

    assert_equal icons[0].strip, ss[0].strip
    assert_equal icons[1].strip, ss[1].strip
    assert_equal icons[2].strip, ss[2].strip
    assert_equal icons[3].strip, ss[3].strip

    spin_time = 0.2
    out = capture_output do
      Spinner.spin
      sleep spin_time
      Spinner.stop
    end

    s = out.string.clone
    ss = s.split("\b")
    assert_equal icons[0], ss[0]

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
collimator-0.0.3 test/spinner_test.rb