Sha256: c7aa9125f2271ff91ab038fd346fe67e998b84b8cdf61a87cba94566d999e85d

Contents?: true

Size: 1.05 KB

Versions: 6

Compression:

Stored size: 1.05 KB

Contents

# -*- encoding : utf-8 -*-
require File.expand_path(File.dirname(__FILE__)) + '/../helper'

class FlipMiddlewareTest < Test::Unit::TestCase
  def test_flip_supports_hash_init
    receiver = flexmock
    
    m = Tracksperanto::Middleware::Flip.new(receiver)
    assert !m.enabled
    
    m = Tracksperanto::Middleware::Flip.new(receiver, :enabled => true)
    assert m.enabled
  end
  
  def test_export_with_enabled_flip
    receiver = flexmock(:exporter)
    receiver.should_receive(:start_export).once.with(110, 120)
    receiver.should_receive(:export_point).once.with(1, 100, 95, 0)

    m = Tracksperanto::Middleware::Flip.new(receiver, :enabled => true)
    m.start_export(110, 120)
    m.export_point(1, 10, 95, 0)
  end

  def test_export_with_disabled_flip
    receiver = flexmock(:exporter)
    receiver.should_receive(:start_export).once.with(110, 120)
    receiver.should_receive(:export_point).once.with(1, 10, 95, 0)

    m = Tracksperanto::Middleware::Flip.new(receiver, :enabled => false)
    m.start_export(110, 120)
    m.export_point(1, 10, 95, 0)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
tracksperanto-2.9.5 test/middleware/test_flip_middleware.rb
tracksperanto-2.9.4 test/middleware/test_flip_middleware.rb
tracksperanto-2.9.3 test/middleware/test_flip_middleware.rb
tracksperanto-2.9.2 test/middleware/test_flip_middleware.rb
tracksperanto-2.9.1 test/middleware/test_flip_middleware.rb
tracksperanto-2.9.0 test/middleware/test_flip_middleware.rb