added behavior section to site index
[god.git] / test / test_condition.rb
blob2abd6cfb66d04fca1d2f42d484c7d16b28d46cf9
1 require 'helper'
3 class TestCondition < Test::Unit::TestCase
4   def test_generate_should_return_an_object_corresponding_to_the_given_type
5     assert_equal Conditions::ProcessNotRunning, Condition.generate(:process_not_running).class
6   end
7   
8   def test_generate_should_raise_on_invalid_type
9     assert_raise NoSuchConditionError do
10       Condition.generate(:foo)
11     end
12   end
13   
14   def test_generate_should_return_a_good_error_message_for_invalid_types
15     emsg = "No Condition found with the class name God::Conditions::FooBar"
16     rmsg = nil
17     
18     begin
19       Condition.generate(:foo_bar)
20     rescue => e
21       rmsg = e.message
22     end
23     
24     assert_equal emsg, rmsg
25   end
26 end