##// END OF EJS Templates
Replaced a custom test with a shoulda macro....
Eric Davis -
r2821:257c92f8f910
parent child
Show More
@@ -28,6 +28,12 class ProjectTest < ActiveSupport::TestCase
28 28 @ecookbook_sub1 = Project.find(3)
29 29 end
30 30
31 should_validate_presence_of :name
32 should_validate_presence_of :identifier
33
34 should_validate_uniqueness_of :name
35 should_validate_uniqueness_of :identifier
36
31 37 def test_truth
32 38 assert_kind_of Project, @ecookbook
33 39 assert_equal "eCookbook", @ecookbook.name
@@ -41,13 +47,6 class ProjectTest < ActiveSupport::TestCase
41 47 assert_equal "eCook", @ecookbook.name
42 48 end
43 49
44 def test_validate
45 @ecookbook.name = ""
46 assert !@ecookbook.save
47 assert_equal 1, @ecookbook.errors.count
48 assert_equal I18n.translate('activerecord.errors.messages.blank'), @ecookbook.errors.on(:name)
49 end
50
51 50 def test_validate_identifier
52 51 to_test = {"abc" => true,
53 52 "ab12" => true,
@@ -62,7 +61,7 class ProjectTest < ActiveSupport::TestCase
62 61 assert_equal valid, p.errors.on('identifier').nil?
63 62 end
64 63 end
65
64
66 65 def test_members_should_be_active_users
67 66 Project.all.each do |project|
68 67 assert_nil project.members.detect {|m| !(m.user.is_a?(User) && m.user.active?) }
General Comments 0
You need to be logged in to leave comments. Login now