Sha256: e4f0a48d6f3a877ee0480e4ea3c2af5c82ae381a6f30c1fc39d403beaa6f77c6

Contents?: true

Size: 1.42 KB

Versions: 11

Compression:

Stored size: 1.42 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_ensure_tracker_forbids_spaces_in_names
    t = Tracksperanto::Tracker.new(:name => "Mary had a \n \t little lamb")
    assert_equal "Mary_had_a_little_lamb", t.name
  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

11 entries across 11 versions & 1 rubygems

Version Path
tracksperanto-1.5.7 test/test_tracker.rb
tracksperanto-1.5.6 test/test_tracker.rb
tracksperanto-1.5.5 test/test_tracker.rb
tracksperanto-1.5.4 test/test_tracker.rb
tracksperanto-1.5.3 test/test_tracker.rb
tracksperanto-1.5.2 test/test_tracker.rb
tracksperanto-1.5.1 test/test_tracker.rb
tracksperanto-1.5.0 test/test_tracker.rb
tracksperanto-1.4.0 test/test_tracker.rb
tracksperanto-1.3.1 test/test_tracker.rb
tracksperanto-1.3.0 test/test_tracker.rb