diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2013-01-18 15:46:38 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2013-01-18 15:46:38 +0000 |
commit | 10c96dba8b79822e1d54ef58bb8139851cf30c80 (patch) | |
tree | c0d7e498814d96929be53b5f15c1348c1dbfa3fb /test/unit/message_test.rb | |
parent | 0f832e0d766b1742a3272d878519df11d01fc2c5 (diff) | |
download | redmine-10c96dba8b79822e1d54ef58bb8139851cf30c80.tar.gz redmine-10c96dba8b79822e1d54ef58bb8139851cf30c80.zip |
not use unnecessary instance variable at unit message test
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11199 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/message_test.rb')
-rw-r--r-- | test/unit/message_test.rb | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/test/unit/message_test.rb b/test/unit/message_test.rb index 770e3c649..ba4cbe048 100644 --- a/test/unit/message_test.rb +++ b/test/unit/message_test.rb @@ -47,13 +47,13 @@ class MessageTest < ActiveSupport::TestCase def test_reply topics_count = @board.topics_count messages_count = @board.messages_count - @message = Message.find(1) - replies_count = @message.replies_count + message = Message.find(1) + replies_count = message.replies_count reply_author = User.find(2) reply = Message.new(:board => @board, :subject => 'Test reply', :content => 'Test reply content', - :parent => @message, :author => reply_author) + :parent => message, :author => reply_author) assert reply.save @board.reload # same topics count @@ -61,42 +61,42 @@ class MessageTest < ActiveSupport::TestCase # messages count incremented assert_equal messages_count+1, @board[:messages_count] assert_equal reply, @board.last_message - @message.reload + message.reload # replies count incremented - assert_equal replies_count+1, @message[:replies_count] - assert_equal reply, @message.last_reply + assert_equal replies_count+1, message[:replies_count] + assert_equal reply, message.last_reply # author should be watching the message - assert @message.watched_by?(reply_author) + assert message.watched_by?(reply_author) end def test_cannot_reply_to_locked_topic topics_count = @board.topics_count messages_count = @board.messages_count - @message = Message.find(1) - replies_count = @message.replies_count - assert_equal false, @message.locked - @message.locked = true - assert @message.save - assert_equal true, @message.locked + message = Message.find(1) + replies_count = message.replies_count + assert_equal false, message.locked + message.locked = true + assert message.save + assert_equal true, message.locked reply_author = User.find(2) reply = Message.new(:board => @board, :subject => 'Test reply', :content => 'Test reply content', - :parent => @message, :author => reply_author) + :parent => message, :author => reply_author) reply.save assert_equal 1, reply.errors.count end def test_moving_message_should_update_counters - @message = Message.find(1) + message = Message.find(1) assert_no_difference 'Message.count' do # Previous board assert_difference 'Board.find(1).topics_count', -1 do - assert_difference 'Board.find(1).messages_count', -(1 + @message.replies_count) do + assert_difference 'Board.find(1).messages_count', -(1 + message.replies_count) do # New board assert_difference 'Board.find(2).topics_count' do - assert_difference 'Board.find(2).messages_count', (1 + @message.replies_count) do - @message.update_attributes(:board_id => 2) + assert_difference 'Board.find(2).messages_count', (1 + message.replies_count) do + message.update_attributes(:board_id => 2) end end end |