]> git.openstreetmap.org Git - rails.git/blob - test/models/changeset_comment_test.rb
Allow customer URL schemas for OAuth callback URLs
[rails.git] / test / models / changeset_comment_test.rb
1 require "test_helper"
2
3 class ChangesetCommentTest < ActiveSupport::TestCase
4   fixtures :changesets, :changeset_comments
5
6   def test_changeset_comment_count
7     assert_equal 4, ChangesetComment.count
8   end
9
10   # validations
11   def test_does_not_accept_invalid_author
12     comment = changeset_comments(:normal_comment_1)
13
14     comment.author = nil
15     assert !comment.valid?
16
17     comment.author_id = 999111
18     assert !comment.valid?
19   end
20
21   def test_does_not_accept_invalid_changeset
22     comment = changeset_comments(:normal_comment_1)
23
24     comment.changeset = nil
25     assert !comment.valid?
26
27     comment.changeset_id = 999111
28     assert !comment.valid?
29   end
30
31   def test_does_not_accept_empty_visible
32     comment = changeset_comments(:normal_comment_1)
33
34     comment.visible = nil
35     assert !comment.valid?
36   end
37
38   def test_comments_of_changeset_count
39     assert_equal 3, Changeset.find(changesets(:normal_user_closed_change).id).comments.count
40   end
41 end