##// END OF EJS Templates
add unit message test of cannot reply to a locked topic...
Toshi MARUYAMA -
r7434:8f362558b6ca
parent child
Show More
@@ -68,6 +68,24 class MessageTest < ActiveSupport::TestCase
68 assert @message.watched_by?(reply_author)
68 assert @message.watched_by?(reply_author)
69 end
69 end
70
70
71 def test_cannot_reply_to_locked_topic
72 topics_count = @board.topics_count
73 messages_count = @board.messages_count
74 @message = Message.find(1)
75 replies_count = @message.replies_count
76 assert_equal false, @message.locked
77 @message.locked = true
78 assert @message.save
79 assert_equal true, @message.locked
80
81 reply_author = User.find(2)
82 reply = Message.new(:board => @board, :subject => 'Test reply',
83 :content => 'Test reply content',
84 :parent => @message, :author => reply_author)
85 reply.save
86 assert_equal 1, reply.errors.count
87 end
88
71 def test_moving_message_should_update_counters
89 def test_moving_message_should_update_counters
72 @message = Message.find(1)
90 @message = Message.find(1)
73 assert_no_difference 'Message.count' do
91 assert_no_difference 'Message.count' do
General Comments 0
You need to be logged in to leave comments. Login now