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
This commit is contained in:
parent
a150689be9
commit
257c92f8f9
|
@ -28,6 +28,12 @@ class ProjectTest < ActiveSupport::TestCase
|
||||||
@ecookbook_sub1 = Project.find(3)
|
@ecookbook_sub1 = Project.find(3)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
should_validate_presence_of :name
|
||||||
|
should_validate_presence_of :identifier
|
||||||
|
|
||||||
|
should_validate_uniqueness_of :name
|
||||||
|
should_validate_uniqueness_of :identifier
|
||||||
|
|
||||||
def test_truth
|
def test_truth
|
||||||
assert_kind_of Project, @ecookbook
|
assert_kind_of Project, @ecookbook
|
||||||
assert_equal "eCookbook", @ecookbook.name
|
assert_equal "eCookbook", @ecookbook.name
|
||||||
|
@ -41,13 +47,6 @@ class ProjectTest < ActiveSupport::TestCase
|
||||||
assert_equal "eCook", @ecookbook.name
|
assert_equal "eCook", @ecookbook.name
|
||||||
end
|
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
|
def test_validate_identifier
|
||||||
to_test = {"abc" => true,
|
to_test = {"abc" => true,
|
||||||
"ab12" => true,
|
"ab12" => true,
|
||||||
|
|
Loading…
Reference in New Issue