From 257c92f8f910dd637173b922d10c54e95ac62205 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Mon, 19 Oct 2009 00:27:08 +0000 Subject: [PATCH] Replaced a custom test with a shoulda macro. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2935 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/unit/project_test.rb | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/test/unit/project_test.rb b/test/unit/project_test.rb index 2ace065ab..6f985cb13 100644 --- a/test/unit/project_test.rb +++ b/test/unit/project_test.rb @@ -28,6 +28,12 @@ class ProjectTest < ActiveSupport::TestCase @ecookbook_sub1 = Project.find(3) end + should_validate_presence_of :name + should_validate_presence_of :identifier + + should_validate_uniqueness_of :name + should_validate_uniqueness_of :identifier + def test_truth assert_kind_of Project, @ecookbook assert_equal "eCookbook", @ecookbook.name @@ -41,13 +47,6 @@ class ProjectTest < ActiveSupport::TestCase assert_equal "eCook", @ecookbook.name end - def test_validate - @ecookbook.name = "" - assert !@ecookbook.save - assert_equal 1, @ecookbook.errors.count - assert_equal I18n.translate('activerecord.errors.messages.blank'), @ecookbook.errors.on(:name) - end - def test_validate_identifier to_test = {"abc" => true, "ab12" => true, @@ -62,7 +61,7 @@ class ProjectTest < ActiveSupport::TestCase assert_equal valid, p.errors.on('identifier').nil? end end - + def test_members_should_be_active_users Project.all.each do |project| assert_nil project.members.detect {|m| !(m.user.is_a?(User) && m.user.active?) } -- 2.39.5