if @message.save
call_hook(:controller_messages_new_after_save, { :params => params, :message => @message})
render_attachment_warning_if_needed(@message)
+ flash[:notice] = l(:notice_successful_create)
redirect_to board_message_path(@board, @message)
end
end
attachments = Attachment.attach_files(@reply, params[:attachments])
render_attachment_warning_if_needed(@reply)
end
+ flash[:notice] = l(:notice_successful_update)
redirect_to board_message_path(@board, @topic, :r => @reply)
end
(render_403; return false) unless @message.destroyable_by?(User.current)
r = @message.to_param
@message.destroy
+ flash[:notice] = l(:notice_successful_delete)
if @message.parent
redirect_to board_message_path(@board, @message.parent, :r => r)
else
}
}
end
+ assert_equal I18n.t(:notice_successful_create), flash[:notice]
message = Message.find_by_subject('Test created message')
assert_not_nil message
assert_redirected_to "/boards/1/topics/#{message.to_param}"
}
}
assert_redirected_to '/boards/1/topics/1'
+ assert_equal I18n.t(:notice_successful_update), flash[:notice]
message = Message.find(1)
assert_equal 'New subject', message.subject
assert_equal 'New body', message.content
}
}
assert_redirected_to '/boards/1/topics/1'
+ assert_equal I18n.t(:notice_successful_update), flash[:notice]
message = Message.find(1)
assert_equal true, message.sticky?
assert_equal true, message.locked?
}
reply = Message.order('id DESC').first
assert_redirected_to "/boards/1/topics/1?r=#{reply.id}"
+ assert_equal I18n.t(:notice_successful_update), flash[:notice]
assert Message.find_by_subject('Test reply')
end
}
end
assert_redirected_to '/projects/ecookbook/boards/1'
+ assert_equal I18n.t(:notice_successful_delete), flash[:notice]
assert_nil Message.find_by_id(1)
end
}
end
assert_redirected_to '/boards/1/topics/1?r=2'
+ assert_equal I18n.t(:notice_successful_delete), flash[:notice]
assert_nil Message.find_by_id(2)
end