Sha256: 6364485a4b0424ba04958c5e746eae4a79f302d2719f08484623b4e0344337ae

Contents?: true

Size: 702 Bytes

Versions: 1

Compression:

Stored size: 702 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::ProcessRunning, Condition.generate(:process_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.2.0 test/test_condition.rb