1 require File.dirname(__FILE__) + '/helper'
3 class TestMeddle < Test::Unit::TestCase
5 Server.stubs(:new).returns(true)
9 def test_should_initialize_watches_to_empty_array
10 assert_equal [], @meddle.watches
13 def test_watches_should_get_stored
15 @meddle.watch { |w| watch = w }
17 assert_equal 1, @meddle.watches.size
18 assert_equal watch, @meddle.watches.first
21 def test_should_kick_off_a_server_instance
22 Server.expects(:new).returns(true)
26 def test_should_take_an_options_hash
28 Meddle.new(:port => 5555)
31 def test_should_allow_multiple_watches
32 @meddle.watch { |w| w.name = 'foo' }
34 assert_nothing_raised do
35 @meddle.watch { |w| w.name = 'bar' }
39 def test_should_disallow_duplicate_watch_names
40 @meddle.watch { |w| w.name = 'foo' }
42 assert_raise AbortCalledError do
43 @meddle.watch { |w| w.name = 'foo' }