Project

General

Profile

Patch #11120 » change_replies_order_with_test.diff

Go MAEDA, 2016-05-08 16:09

View differences:

app/controllers/messages_controller.rb (working copy)
limit(@reply_pages.per_page).
offset(@reply_pages.offset).
to_a
@replies.reverse! if User.current.wants_comments_in_reverse_order?
@reply = Message.new(:subject => "RE: #{@message.subject}")
render :action => "show", :layout => false if request.xhr?
test/functional/messages_controller_test.rb (working copy)
assert_select 'div#reply textarea#message_content'
end
def test_show_comments_sorting_desc
user = User.find(2)
user.pref.comments_sorting = 'desc'
user.pref.save!
@request.session[:user_id] = user.id
get :show, :board_id => 1, :id => 1
assert_response :success
replies = assigns(:replies)
assert replies.first.created_on > replies.last.created_on
end
def test_show_message_not_found
get :show, :board_id => 1, :id => 99999
assert_response 404
(2-2/2)