view plugins/redmine_bibliography/test/unit/publication_test.rb @ 1433:cfa80f738847 bibliography_testing

Fixed assertion error message.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Tue, 08 Oct 2013 17:29:47 +0100
parents 95a6d8cecdb8
children
line wrap: on
line source
# publication_test

require File.expand_path(File.dirname(__FILE__) + '/../test_helper')

class PublicationTest < ActiveSupport::TestCase
    self.fixture_path = File.dirname(__FILE__) + "/../fixtures/"

    fixtures :publications, :authorships

    # Replace this with your real tests.
    def test_truth
        assert true
    end

    def test_relationships
        # test authorships - publication relationship
        publication = Publication.find(1)

        assert_equal 4, publication.authorships.count, "Error: was expecting 4 authorships"
    end

    def test_new_publication_validations
        pub = Publication.create

        assert !pub.valid?, "!pub.valid?"
        assert_equal 2, pub.errors.count, "Number of errors"
        assert_equal ["can't be blank"], pub.errors[:title]
        assert_equal ["Please add at least one author to this publication."], pub.errors[:authorships]
    end

end