1 # -*- coding: utf-8 -*-
4 class NoteTest < ActiveSupport::TestCase
5 fixtures :users, :notes, :note_comments
8 ok = [ "open", "closed", "hidden" ]
9 bad = [ "expropriated", "fubared" ]
12 note = notes(:open_note)
14 assert note.valid?, "#{status} is invalid, when it should be"
18 note = notes(:open_note)
20 assert !note.valid?, "#{status} is valid when it shouldn't be"
25 note = notes(:open_note)
26 assert_equal "open", note.status
27 assert_nil note.closed_at
29 assert_equal "closed", note.status
30 assert_not_nil note.closed_at
34 note = notes(:closed_note_with_comment)
35 assert_equal "closed", note.status
36 assert_not_nil note.closed_at
38 assert_equal "open", note.status
39 assert_nil note.closed_at
43 assert_equal true, notes(:open_note).visible?
44 assert_equal true, notes(:note_with_hidden_comment).visible?
45 assert_equal false, notes(:hidden_note_with_comment).visible?
49 assert_equal true, notes(:closed_note_with_comment).closed?
50 assert_equal false, notes(:open_note).closed?
54 assert_nil notes(:open_note).author
55 assert_equal users(:normal_user), notes(:note_with_comments_by_users).author
59 assert_equal IPAddr.new("192.168.1.1"), notes(:open_note).author_ip
60 assert_nil notes(:note_with_comments_by_users).author_ip