Index: de.wigbels.ruby/contact/test/fixtures/contactgroups.yml
===================================================================
--- de.wigbels.ruby/contact/test/fixtures/contactgroups.yml	(revision 7b7d827c4fbf1c46a6aab6ad9e1ae735e3bdb79d)
+++ de.wigbels.ruby/contact/test/fixtures/contactgroups.yml	(revision 7b7d827c4fbf1c46a6aab6ad9e1ae735e3bdb79d)
@@ -0,0 +1,5 @@
+# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
+one:
+  id: 1
+two:
+  id: 2
Index: de.wigbels.ruby/contact/test/fixtures/contactmailer/send_mail_to_contact
===================================================================
--- de.wigbels.ruby/contact/test/fixtures/contactmailer/send_mail_to_contact	(revision 7b7d827c4fbf1c46a6aab6ad9e1ae735e3bdb79d)
+++ de.wigbels.ruby/contact/test/fixtures/contactmailer/send_mail_to_contact	(revision 7b7d827c4fbf1c46a6aab6ad9e1ae735e3bdb79d)
@@ -0,0 +1,3 @@
+Contactmailer#send_mail_to_contactgroup
+
+Find me in app/views/contactmailer/send_mail_to_contactgroup.rhtml
Index: de.wigbels.ruby/contact/test/fixtures/contacts.yml
===================================================================
--- de.wigbels.ruby/contact/test/fixtures/contacts.yml	(revision 7b7d827c4fbf1c46a6aab6ad9e1ae735e3bdb79d)
+++ de.wigbels.ruby/contact/test/fixtures/contacts.yml	(revision 7b7d827c4fbf1c46a6aab6ad9e1ae735e3bdb79d)
@@ -0,0 +1,5 @@
+# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
+one:
+  id: 1
+two:
+  id: 2
Index: de.wigbels.ruby/contact/test/functional/admincontact_controller_test.rb
===================================================================
--- de.wigbels.ruby/contact/test/functional/admincontact_controller_test.rb	(revision 7b7d827c4fbf1c46a6aab6ad9e1ae735e3bdb79d)
+++ de.wigbels.ruby/contact/test/functional/admincontact_controller_test.rb	(revision 7b7d827c4fbf1c46a6aab6ad9e1ae735e3bdb79d)
@@ -0,0 +1,92 @@
+require File.dirname(__FILE__) + '/../test_helper'
+require 'admincontact_controller'
+
+# Re-raise errors caught by the controller.
+class AdmincontactController; def rescue_action(e) raise e end; end
+
+class AdmincontactControllerTest < Test::Unit::TestCase
+  fixtures :contacts
+
+  def setup
+    @controller = AdmincontactController.new
+    @request    = ActionController::TestRequest.new
+    @response   = ActionController::TestResponse.new
+
+    @first_id = contacts(:first).id
+  end
+
+  def test_index
+    get :index
+    assert_response :success
+    assert_template 'list'
+  end
+
+  def test_list
+    get :list
+
+    assert_response :success
+    assert_template 'list'
+
+    assert_not_nil assigns(:contacts)
+  end
+
+  def test_show
+    get :show, :id => @first_id
+
+    assert_response :success
+    assert_template 'show'
+
+    assert_not_nil assigns(:contact)
+    assert assigns(:contact).valid?
+  end
+
+  def test_new
+    get :new
+
+    assert_response :success
+    assert_template 'new'
+
+    assert_not_nil assigns(:contact)
+  end
+
+  def test_create
+    num_contacts = Contact.count
+
+    post :create, :contact => {}
+
+    assert_response :redirect
+    assert_redirected_to :action => 'list'
+
+    assert_equal num_contacts + 1, Contact.count
+  end
+
+  def test_edit
+    get :edit, :id => @first_id
+
+    assert_response :success
+    assert_template 'edit'
+
+    assert_not_nil assigns(:contact)
+    assert assigns(:contact).valid?
+  end
+
+  def test_update
+    post :update, :id => @first_id
+    assert_response :redirect
+    assert_redirected_to :action => 'show', :id => @first_id
+  end
+
+  def test_destroy
+    assert_nothing_raised {
+      Contact.find(@first_id)
+    }
+
+    post :destroy, :id => @first_id
+    assert_response :redirect
+    assert_redirected_to :action => 'list'
+
+    assert_raise(ActiveRecord::RecordNotFound) {
+      Contact.find(@first_id)
+    }
+  end
+end
Index: de.wigbels.ruby/contact/test/functional/admincontactgroup_controller_test.rb
===================================================================
--- de.wigbels.ruby/contact/test/functional/admincontactgroup_controller_test.rb	(revision 7b7d827c4fbf1c46a6aab6ad9e1ae735e3bdb79d)
+++ de.wigbels.ruby/contact/test/functional/admincontactgroup_controller_test.rb	(revision 7b7d827c4fbf1c46a6aab6ad9e1ae735e3bdb79d)
@@ -0,0 +1,92 @@
+require File.dirname(__FILE__) + '/../test_helper'
+require 'admincontactgroup_controller'
+
+# Re-raise errors caught by the controller.
+class AdmincontactgroupController; def rescue_action(e) raise e end; end
+
+class AdmincontactgroupControllerTest < Test::Unit::TestCase
+  fixtures :contactgroups
+
+  def setup
+    @controller = AdmincontactgroupController.new
+    @request    = ActionController::TestRequest.new
+    @response   = ActionController::TestResponse.new
+
+    @first_id = contactgroups(:first).id
+  end
+
+  def test_index
+    get :index
+    assert_response :success
+    assert_template 'list'
+  end
+
+  def test_list
+    get :list
+
+    assert_response :success
+    assert_template 'list'
+
+    assert_not_nil assigns(:contactgroups)
+  end
+
+  def test_show
+    get :show, :id => @first_id
+
+    assert_response :success
+    assert_template 'show'
+
+    assert_not_nil assigns(:contactgroup)
+    assert assigns(:contactgroup).valid?
+  end
+
+  def test_new
+    get :new
+
+    assert_response :success
+    assert_template 'new'
+
+    assert_not_nil assigns(:contactgroup)
+  end
+
+  def test_create
+    num_contactgroups = Contactgroup.count
+
+    post :create, :contactgroup => {}
+
+    assert_response :redirect
+    assert_redirected_to :action => 'list'
+
+    assert_equal num_contactgroups + 1, Contactgroup.count
+  end
+
+  def test_edit
+    get :edit, :id => @first_id
+
+    assert_response :success
+    assert_template 'edit'
+
+    assert_not_nil assigns(:contactgroup)
+    assert assigns(:contactgroup).valid?
+  end
+
+  def test_update
+    post :update, :id => @first_id
+    assert_response :redirect
+    assert_redirected_to :action => 'show', :id => @first_id
+  end
+
+  def test_destroy
+    assert_nothing_raised {
+      Contactgroup.find(@first_id)
+    }
+
+    post :destroy, :id => @first_id
+    assert_response :redirect
+    assert_redirected_to :action => 'list'
+
+    assert_raise(ActiveRecord::RecordNotFound) {
+      Contactgroup.find(@first_id)
+    }
+  end
+end
Index: de.wigbels.ruby/contact/test/functional/listcontactgroup_controller_test.rb
===================================================================
--- de.wigbels.ruby/contact/test/functional/listcontactgroup_controller_test.rb	(revision 7b7d827c4fbf1c46a6aab6ad9e1ae735e3bdb79d)
+++ de.wigbels.ruby/contact/test/functional/listcontactgroup_controller_test.rb	(revision 7b7d827c4fbf1c46a6aab6ad9e1ae735e3bdb79d)
@@ -0,0 +1,18 @@
+require File.dirname(__FILE__) + '/../test_helper'
+require 'listcontactgroup_controller'
+
+# Re-raise errors caught by the controller.
+class ListcontactgroupController; def rescue_action(e) raise e end; end
+
+class ListcontactgroupControllerTest < Test::Unit::TestCase
+  def setup
+    @controller = ListcontactgroupController.new
+    @request    = ActionController::TestRequest.new
+    @response   = ActionController::TestResponse.new
+  end
+
+  # Replace this with your real tests.
+  def test_truth
+    assert true
+  end
+end
Index: de.wigbels.ruby/contact/test/functional/login_controller_test.rb
===================================================================
--- de.wigbels.ruby/contact/test/functional/login_controller_test.rb	(revision 7b7d827c4fbf1c46a6aab6ad9e1ae735e3bdb79d)
+++ de.wigbels.ruby/contact/test/functional/login_controller_test.rb	(revision 7b7d827c4fbf1c46a6aab6ad9e1ae735e3bdb79d)
@@ -0,0 +1,18 @@
+require File.dirname(__FILE__) + '/../test_helper'
+require 'login_controller'
+
+# Re-raise errors caught by the controller.
+class LoginController; def rescue_action(e) raise e end; end
+
+class LoginControllerTest < Test::Unit::TestCase
+  def setup
+    @controller = LoginController.new
+    @request    = ActionController::TestRequest.new
+    @response   = ActionController::TestResponse.new
+  end
+
+  # Replace this with your real tests.
+  def test_truth
+    assert true
+  end
+end
Index: de.wigbels.ruby/contact/test/test_helper.rb
===================================================================
--- de.wigbels.ruby/contact/test/test_helper.rb	(revision 7b7d827c4fbf1c46a6aab6ad9e1ae735e3bdb79d)
+++ de.wigbels.ruby/contact/test/test_helper.rb	(revision 7b7d827c4fbf1c46a6aab6ad9e1ae735e3bdb79d)
@@ -0,0 +1,28 @@
+ENV["RAILS_ENV"] = "test"
+require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
+require 'test_help'
+
+class Test::Unit::TestCase
+  # Transactional fixtures accelerate your tests by wrapping each test method
+  # in a transaction that's rolled back on completion.  This ensures that the
+  # test database remains unchanged so your fixtures don't have to be reloaded
+  # between every test method.  Fewer database queries means faster tests.
+  #
+  # Read Mike Clark's excellent walkthrough at
+  #   http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
+  #
+  # Every Active Record database supports transactions except MyISAM tables
+  # in MySQL.  Turn off transactional fixtures in this case; however, if you
+  # don't care one way or the other, switching from MyISAM to InnoDB tables
+  # is recommended.
+  self.use_transactional_fixtures = true
+
+  # Instantiated fixtures are slow, but give you @david where otherwise you
+  # would need people(:david).  If you don't want to migrate your existing
+  # test cases which use the @david style and don't mind the speed hit (each
+  # instantiated fixtures translates to a database query per test method),
+  # then set this back to true.
+  self.use_instantiated_fixtures  = false
+
+  # Add more helper methods to be used by all tests here...
+end
Index: de.wigbels.ruby/contact/test/unit/contact_test.rb
===================================================================
--- de.wigbels.ruby/contact/test/unit/contact_test.rb	(revision 7b7d827c4fbf1c46a6aab6ad9e1ae735e3bdb79d)
+++ de.wigbels.ruby/contact/test/unit/contact_test.rb	(revision 7b7d827c4fbf1c46a6aab6ad9e1ae735e3bdb79d)
@@ -0,0 +1,10 @@
+require File.dirname(__FILE__) + '/../test_helper'
+
+class ContactTest < Test::Unit::TestCase
+  fixtures :contacts
+
+  # Replace this with your real tests.
+  def test_truth
+    assert true
+  end
+end
Index: de.wigbels.ruby/contact/test/unit/contactgroup_test.rb
===================================================================
--- de.wigbels.ruby/contact/test/unit/contactgroup_test.rb	(revision 7b7d827c4fbf1c46a6aab6ad9e1ae735e3bdb79d)
+++ de.wigbels.ruby/contact/test/unit/contactgroup_test.rb	(revision 7b7d827c4fbf1c46a6aab6ad9e1ae735e3bdb79d)
@@ -0,0 +1,16 @@
+require File.dirname(__FILE__) + '/../test_helper'
+
+class ContactgroupTest < Test::Unit::TestCase
+  fixtures :contactgroups
+
+  # Replace this with your real tests.
+  def test_truth
+    assert true
+  end
+  
+  def test_groupname_validation
+    contactgroup = Contactgroup.new
+    assert !contactgroup.valid?
+    assert contactgroup.errors.invalid?(:groupname)
+  end
+end
Index: de.wigbels.ruby/contact/test/unit/contactmailer_test.rb
===================================================================
--- de.wigbels.ruby/contact/test/unit/contactmailer_test.rb	(revision 7b7d827c4fbf1c46a6aab6ad9e1ae735e3bdb79d)
+++ de.wigbels.ruby/contact/test/unit/contactmailer_test.rb	(revision 7b7d827c4fbf1c46a6aab6ad9e1ae735e3bdb79d)
@@ -0,0 +1,35 @@
+require File.dirname(__FILE__) + '/../test_helper'
+
+class ContactmailerTest < Test::Unit::TestCase
+  FIXTURES_PATH = File.dirname(__FILE__) + '/../fixtures'
+  CHARSET = "utf-8"
+
+  include ActionMailer::Quoting
+
+  def setup
+    ActionMailer::Base.delivery_method = :test
+    ActionMailer::Base.perform_deliveries = true
+    ActionMailer::Base.deliveries = []
+
+    @expected = TMail::Mail.new
+    @expected.set_content_type "text", "plain", { "charset" => CHARSET }
+    @expected.mime_version = '1.0'
+  end
+
+  def test_send_mail_to_contact
+    @expected.subject = 'Contactmailer#send_mail_to_contact'
+    @expected.body    = read_fixture('send_mail_to_contact')
+    @expected.date    = Time.now
+
+    assert_equal @expected.encoded, Contactmailer.create_send_mail_to_contact(@expected.date).encoded
+  end
+
+  private
+    def read_fixture(action)
+      IO.readlines("#{FIXTURES_PATH}/contactmailer/#{action}")
+    end
+
+    def encode(subject)
+      quoted_printable(subject, CHARSET)
+    end
+end
