Sha256: 76e46f07672d0ecda3b2e5838ad68caa6520c0b2bb3a5ad8334154ddcaaf2bc9

Contents?: true

Size: 709 Bytes

Versions: 1

Compression:

Stored size: 709 Bytes

Contents

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

class TestCondition < Test::Unit::TestCase
  def test_generate_should_return_an_object_corresponding_to_the_given_type
    assert_equal Conditions::ProcessNotRunning, Condition.generate(:process_not_running).class
  end
  
  def test_generate_should_raise_on_invalid_type
    assert_raise NoSuchConditionError do
      Condition.generate(:foo)
    end
  end
  
  def test_generate_should_return_a_good_error_message_for_invalid_types
    emsg = "No Condition found with the class name God::Conditions::FooBar"
    rmsg = nil
    
    begin
      Condition.generate(:foo_bar)
    rescue => e
      rmsg = e.message
    end
    
    assert_equal emsg, rmsg
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
god-0.1.0 test/test_condition.rb