Revision 1425:cd304b50908c plugins/redmine_bibliography/test/unit

View differences:

plugins/redmine_bibliography/test/unit/author_test.rb
1
require File.dirname(__FILE__) + '/../test_helper'
1
# author_test.rb
2

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

  
3 5
class AuthorTest < ActiveSupport::TestCase
4
  fixtures :authors
6
    self.fixture_path = File.dirname(__FILE__) + "/../fixtures/"
7
    fixtures :users, :authors, :authorships
5 8

  
6
  # Replace this with your real tests.
7
  def test_truth
8
    assert true
9
  end
9
    def test_relationships
10
        author = Author.find(1)
11

  
12
        assert_equal(author.authorships.first.name_on_paper, "Yih-Farn R. Chen")
13
        assert_equal(author.authorships.count, 2)
14

  
15
    end
16

  
10 17
end
plugins/redmine_bibliography/test/unit/authorship_test.rb
5 5

  
6 6
  # Replace this with your real tests.
7 7
  def test_truth
8
        luis = Author.first
9

  
10

  
8 11
    assert true
9 12
  end
13

  
14

  
15

  
10 16
end
plugins/redmine_bibliography/test/unit/publication_test.rb
1
require File.dirname(__FILE__) + '/../test_helper'
1
# publication_test
2

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

  
3 5
class PublicationTest < ActiveSupport::TestCase
4
  fixtures :publications
6
    self.fixture_path = File.dirname(__FILE__) + "/../fixtures/"
5 7

  
6
  # Replace this with your real tests.
7
  def test_truth
8
    assert true
9
  end
8
    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
        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
    end
30

  
10 31
end

Also available in: Unified diff