view plugins/redmine_bibliography/test/unit/publication_test.rb @ 1391:8580d1d1150e luisf

Adding 2 new js scripts; added the code removed from the partials. Minor cleaning.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Wed, 25 Sep 2013 17:44:48 +0100
parents 95a6d8cecdb8
children cfa80f738847
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 4, publication.authorships.count
    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