@@ -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, |
General Comments 0
You need to be logged in to leave comments.
Login now