To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / plugins / redmine_bibliography / test / unit / publication_test.rb @ 1425:cd304b50908c
History | View | Annotate | Download (870 Bytes)
| 1 | 1373:95a6d8cecdb8 | luis | # publication_test
|
|---|---|---|---|
| 2 | |||
| 3 | 1371:a8d468e143f7 | luis | require File.expand_path(File.dirname(__FILE__) + '/../test_helper') |
| 4 | 328:aed18b463206 | luis | |
| 5 | class PublicationTest < ActiveSupport::TestCase |
||
| 6 | 1371:a8d468e143f7 | luis | self.fixture_path = File.dirname(__FILE__) + "/../fixtures/" |
| 7 | 328:aed18b463206 | luis | |
| 8 | 1371:a8d468e143f7 | luis | fixtures :publications, :authorships |
| 9 | |||
| 10 | # Replace this with your real tests.
|
||
| 11 | def test_truth |
||
| 12 | assert true
|
||
| 13 | end
|
||
| 14 | |||
| 15 | def test_relationships |
||
| 16 | # test authorships - publication relationship
|
||
| 17 | publication = Publication.find(1) |
||
| 18 | |||
| 19 | 1373:95a6d8cecdb8 | luis | 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] |
||
| 29 | 1371:a8d468e143f7 | luis | end
|
| 30 | |||
| 31 | 328:aed18b463206 | luis | end |