Revision 1373:95a6d8cecdb8 plugins/redmine_bibliography/test/unit
| plugins/redmine_bibliography/test/unit/publication_test.rb | ||
|---|---|---|
| 1 |
# publication_test |
|
| 2 |
|
|
| 1 | 3 |
require File.expand_path(File.dirname(__FILE__) + '/../test_helper') |
| 2 | 4 |
|
| 3 | 5 |
class PublicationTest < ActiveSupport::TestCase |
| ... | ... | |
| 14 | 16 |
# test authorships - publication relationship |
| 15 | 17 |
publication = Publication.find(1) |
| 16 | 18 |
|
| 17 |
assert publication.authorships.count == 4 |
|
| 19 |
assert 4, publication.authorships.count |
|
| 20 |
end |
|
| 21 |
|
|
| 22 |
def test_new_publication_validations |
|
| 23 |
pub = Publication.create |
|
| 24 |
|
|
| 25 |
assert !pub.valid?, "!pub.valid?" |
|
| 26 |
assert_equal 2, pub.errors.count, "Number of errors" |
|
| 27 |
assert_equal ["can't be blank"], pub.errors[:title] |
|
| 28 |
assert_equal ["Please add at least one author to this publication."], pub.errors[:authorships] |
|
| 18 | 29 |
end |
| 19 | 30 |
|
| 20 | 31 |
end |
Also available in: Unified diff