-
Notifications
You must be signed in to change notification settings - Fork 18
Changes to the working post branch #53
base: master
Are you sure you want to change the base?
Conversation
Horrible Pull Request title btw |
@ScottH this should be ready to merge as well |
@@ -21,3 +21,8 @@ module.exports.show = function (req, res) { | |||
res.render('post/show', {post: post}); | |||
}); | |||
}; | |||
|
|||
module.exports.parse = function (req, res, next) { | |||
req.body.text = Post.parse(req.body.text); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure this is correct as req.body.text
becomes an object here?
Pull the lastest changes from master and you should see a failing test |
…ongo now has a content key with an object that contains text
… submitting it to the database, and added tests for the constructor
@sscotth updates have been made to Post.create and passing tests were added |
|
||
Post.validate = function (post) { | ||
var postArray = post.trim().split(' '); | ||
if (postArray[0] === ''){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use different variable names here.
Try:
var words = post.trim().split(' ');
var firstWord = words[0];
var secondWord = words[0];
I think you should consider making validation your middleware and not mangling the post text into an array. Simply validate and pass to Run your parse function during the Let me know if you are unsure what I mean. |
No description provided.