Sha256: 577ce9ca03057bc6ae2ff4d26742bb3a523ccf3f9d09b69c32b9551ebcbf8954

Contents?: true

Size: 1.24 KB

Versions: 6

Compression:

Stored size: 1.24 KB

Contents

require File.dirname(__FILE__) + '/helper'

class TrackerTest < Test::Unit::TestCase
  
  def test_supports_block_init
    t = Tracksperanto::Tracker.new do |t| 
      t.name = 'Foo'
    end
    assert_equal "Foo", t.name
  end
  
  def test_responds_to_needed_methods
    t = Tracksperanto::Tracker.new
    assert_respond_to t, :name
    assert_respond_to t, :each
    assert_respond_to t, :keyframes
  end
  
  def test_supports_hash_init
    assert_equal "Foo", Tracksperanto::Tracker.new(:name => "Foo").name
  end
  
  def test_supports_hash_init_with_keyframes
    assert_equal [1,2], Tracksperanto::Tracker.new(:keyframes => [1,2]).keyframes
  end
  
  def test_supports_array_methods
    t = Tracksperanto::Tracker.new(:keyframes => [1,2])
    assert_equal [1,2], t.to_a
    assert_equal 2, t.length
    t.push(3)
    assert_equal 3, t.length
    assert_equal [1,2,3], t.to_a
  end
    
  def test_inspect
    t = Tracksperanto::Tracker.new(:name => "FooTracker")
    assert_equal '<T "FooTracker" with 0 keyframes>', t.inspect
  end
  
  def test_enumerates_keyframe_values_and_returns_length
    t = Tracksperanto::Tracker.new(:keyframes => [:a, :b])
    assert_equal [:a, :b], t.map{|e| e}
    assert_equal 2, t.length
    assert_equal :a, t[0]
  end
  
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
tracksperanto-1.2.6 test/test_tracker.rb
tracksperanto-1.2.4 test/test_tracker.rb
tracksperanto-1.2.3 test/test_tracker.rb
tracksperanto-1.2.2 test/test_tracker.rb
tracksperanto-1.2.1 test/test_tracker.rb
tracksperanto-1.2.0 test/test_tracker.rb