Sha256: 6424d8ef844e08184a3a893f7622f1f2a60cc2ef6ecc7860d2307b4108df62c5

Contents?: true

Size: 1.21 KB

Versions: 17

Compression:

Stored size: 1.21 KB

Contents

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

class LengthCutoffMiddlewareTest < Test::Unit::TestCase
  def test_default_length_set_to_zero_and_ignored
    receiver = flexmock
    m = Tracksperanto::Middleware::LengthCutoff.new(receiver)
    assert_equal 0, m.min_length
  end
  
  def test_slip_supports_hash_init
    receiver = flexmock
    m = Tracksperanto::Middleware::LengthCutoff.new(receiver, :min_length => 23)
    assert_equal 23, m.min_length
  end
  
  def test_slipper_bypasses_methods
    receiver = flexmock
    receiver.should_receive(:start_export).once.with(120,120)
    receiver.should_receive(:start_tracker_segment).once.with("Tracker")
    12.times do | i |
      receiver.should_receive(:export_point).with(i, 100, 100, 0)
    end
    receiver.should_receive(:end_tracker_segment).once
    receiver.should_receive(:end_export).once
    
    
    m = Tracksperanto::Middleware::LengthCutoff.new(receiver, :min_length => 12)
    m.start_export(120, 120)
    m.start_tracker_segment("Tracker")
    12.times {|t|  m.export_point(t, 100, 100, 0) }
    m.end_tracker_segment
    m.start_tracker_segment("Tracker2")
    11.times {|t|  m.export_point(t, 100, 100, 0) }
    m.end_tracker_segment
    m.end_export
    
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
tracksperanto-2.0.1 test/middleware/test_length_cutoff_middleware.rb
tracksperanto-2.0.0 test/middleware/test_length_cutoff_middleware.rb
tracksperanto-1.9.9 test/middleware/test_length_cutoff_middleware.rb
tracksperanto-1.9.8 test/middleware/test_length_cutoff_middleware.rb
tracksperanto-1.9.6 test/middleware/test_length_cutoff_middleware.rb
tracksperanto-1.9.5 test/middleware/test_length_cutoff_middleware.rb
tracksperanto-1.9.4 test/middleware/test_length_cutoff_middleware.rb
tracksperanto-1.9.3 test/middleware/test_length_cutoff_middleware.rb
tracksperanto-1.9.2 test/middleware/test_length_cutoff_middleware.rb
tracksperanto-1.9.1 test/middleware/test_length_cutoff_middleware.rb
tracksperanto-1.9.0 test/middleware/test_length_cutoff_middleware.rb
tracksperanto-1.8.4 test/middleware/test_length_cutoff_middleware.rb
tracksperanto-1.8.2 test/middleware/test_length_cutoff_middleware.rb
tracksperanto-1.8.1 test/middleware/test_length_cutoff_middleware.rb
tracksperanto-1.8.0 test/middleware/test_length_cutoff_middleware.rb
tracksperanto-1.7.5 test/middleware/test_length_cutoff_middleware.rb
tracksperanto-1.7.4 test/middleware/test_length_cutoff_middleware.rb